protected void doCallbackGroupsOperation(String userId, List<String> groupIds) {

    if (userId != null) {

      if (groupIds != null && groupIds.size() > 0) {

        List<String> userGroups = userGroupCallback.getGroupsForUser(userId, groupIds, null);
        for (String groupId : groupIds) {

          if (userGroupCallback.existsGroup(groupId)
              && userGroups != null
              && userGroups.contains(groupId)) {
            addGroupFromCallbackOperation(groupId);
          }
        }
      } else {
        if (!(userGroupsMap.containsKey(userId) && userGroupsMap.get(userId).booleanValue())) {
          List<String> userGroups = userGroupCallback.getGroupsForUser(userId, null, null);
          if (userGroups != null && userGroups.size() > 0) {
            for (String group : userGroups) {
              addGroupFromCallbackOperation(group);
            }
            userGroupsMap.put(userId, true);
          }
        }
      }
    } else {
      if (groupIds != null) {
        for (String groupId : groupIds) {
          addGroupFromCallbackOperation(groupId);
        }
      }
    }
  }
  protected List<String> doUserGroupCallbackOperation(String userId, List<String> groupIds) {

    doCallbackUserOperation(userId);
    doCallbackGroupsOperation(userId, groupIds);
    List<String> allGroupIds = null;

    return userGroupCallback.getGroupsForUser(userId, groupIds, allGroupIds);
  }