if (newName) renameIdentity(ldapAccount, identity, name);
if (newName) renameIdentity(ldapEntry, identity, name);
    public void modifyIdentity(Account account, String identityName, Map<String, Object> identityAttrs) throws ServiceException {        LdapAccount ldapAccount = (LdapAccount) (account instanceof LdapAccount ? account : getAccountById(account.getId()));        if (ldapAccount == null)             throw AccountServiceException.NO_SUCH_ACCOUNT(account.getName());        if (identityName.equalsIgnoreCase(DEFAULT_IDENTITY_NAME)) {            // make sure they are all valid identity attrs, since we are setting them on account we don't            // want someone to sneak in some other account attrs            Set<String> validAttrs = AttributeManager.getInstance().getAttrsInClass(AttributeClass.identity);            for (String key : identityAttrs.keySet()) {                if (!validAttrs.contains(key))                    throw ServiceException.INVALID_REQUEST("unable to modify attr: "+key, null);            }            modifyAttrs(ldapAccount, identityAttrs);        } else {                    LdapIdentity identity = (LdapIdentity) getIdentityByName(ldapAccount, identityName, null);            if (identity == null)                    throw AccountServiceException.NO_SUCH_IDENTITY(identityName);                       String name = (String) identityAttrs.get(A_zimbraPrefIdentityName);            boolean newName = (name != null && !name.equals(identityName));            if (newName) identityAttrs.remove(A_zimbraPrefIdentityName);                        modifyAttrs(identity, identityAttrs, true);            if (newName) renameIdentity(ldapAccount, identity, name);                    }    }