private void updateMemberList(Group oldGroup, Group newGroup) throws CharonException, IdentityStoreException {
List<String> newUserIds = new ArrayList<>();
MultiValuedAttribute newMembersAttribute = (MultiValuedAttribute)
newGroup.getAttribute(SCIMConstants.GroupSchemaConstants.MEMBERS);
if (newMembersAttribute != null) {
List<Attribute> membersValues = newMembersAttribute.getAttributeValues();
for (Attribute attribute : membersValues) {
ComplexAttribute attributeValue = (ComplexAttribute) attribute;
SimpleAttribute valueAttribute = (SimpleAttribute)
attributeValue.getSubAttribute(SCIMConstants.CommonSchemaConstants.VALUE);
newUserIds.add((String) valueAttribute.getValue());
}
}
identityStore.updateUsersOfGroup(oldGroup.getId(), newUserIds);
}
}