account.setEmail(user.getEmail());
account.setUsername(user.getFirstName().toLowerCase() + user.getLastName().toLowerCase());
String existingGroupUrl = null;
if (account.getGroupMemberships().iterator().hasNext()) {
GroupMembership groupMembership = account.getGroupMemberships().iterator().next();
existingGroupUrl = groupMembership.getGroup().getHref();
if (!existingGroupUrl.equals(user.getGroupUrl())) {
groupMembership.delete();
existingGroupUrl = null;
}
}
if (user.getGroupUrl() != null && !user.getGroupUrl().isEmpty() && existingGroupUrl == null) {