class UsersStateDifference {

    public static ImmutableMultimap<String, String> calculateGroupMembershipToRemove(UmsUsersState umsState, UsersState ipaState) {
        Multimap<String, String> groupMembershipToRemove = HashMultimap.create();
        ipaState.getGroupMembership().forEach((group, user) -> {
            if (!FreeIpaChecks.IPA_UNMANAGED_GROUPS.contains(group) && !umsState.getUsersState().getGroupMembership().containsEntry(group, user)) {
                LOGGER.debug("removing user : {} to group : {}", user, group);
                groupMembershipToRemove.put(group, user);
            }
        });

        LOGGER.info("groupMembershipToRemove size = {}", groupMembershipToRemove.size());
        LOGGER.debug("groupMembershipToRemove = {}", groupMembershipToRemove.asMap());

        return ImmutableMultimap.copyOf(groupMembershipToRemove);
    }

    public  UsersStateDifference(ImmutableSet<FmsGroup> groupsToAdd, ImmutableSet<FmsGroup> groupsToRemove,
            ImmutableSet<FmsUser> usersToAdd, ImmutableSet<String> usersToRemove,
            ImmutableMultimap<String, String> groupMembershipToAdd, ImmutableMultimap<String, String> groupMembershipToRemove);

}