public void addNewCollaborators(
      Content content, List<User> userList, User apiCaller, String predicate, boolean addToShelf) {

    Set<ContentPermission> contentPermissions = content.getContentPermissions();

    if (contentPermissions == null) {
      contentPermissions = new HashSet<ContentPermission>();
    }

    if (userList != null && userList.size() > 0) {
      Date date = new Date();
      for (User user : userList) {
        if (!user.getGooruUId().equals(content.getUser().getGooruUId())) {
          boolean newFlag = true;
          for (ContentPermission contentPermission : contentPermissions) {
            if (contentPermission.getParty().getPartyUid().equals(user.getPartyUid())) {
              newFlag = false;
              break;
            }
          }
          if (newFlag) {
            ContentPermission contentPerm = new ContentPermission();
            contentPerm.setParty(user);
            contentPerm.setContent(content);
            contentPerm.setPermission(EDIT);
            contentPerm.setValidFrom(date);
            contentPermissions.add(contentPerm);
          }
        }
      }
    }
    if (contentPermissions != null && contentPermissions.size() > 0) {
      content.setContentPermissions(contentPermissions);
    }
  }
  public void deleteCollaborators(
      Content content, List<User> userList, User apiCaller, String predicate) {

    Set<ContentPermission> contentPermissions = content.getContentPermissions();
    Set<ContentPermission> removePermissions = new HashSet<ContentPermission>();

    for (ContentPermission contentPermission : contentPermissions) {
      for (User user : userList) {
        if (user.getPartyUid().equalsIgnoreCase(contentPermission.getParty().getPartyUid())) {
          removePermissions.add(contentPermission);
          break;
        }
      }
    }
    if (removePermissions.size() > 0) {
      contentPermissions.removeAll(removePermissions);
      this.getBaseRepository().removeAll(removePermissions);
    }

    this.getBaseRepository().saveAll(contentPermissions);
    this.getBaseRepository().flush();
  }