private void editComment(
      IssueChangeHolder issueChangeHolder, Map<String, Object> commentParams, String body) {
    final ApplicationUser user = authenticationContext.getUser();
    final long commentId = Long.valueOf((String) commentParams.get(PARAM_COMMENT_ID));
    final ErrorCollection errorCollection = new SimpleErrorCollection();

    MutableComment mutableComment =
        commentService.getMutableComment(user, commentId, errorCollection);
    CommentParametersBuilder builder = CommentParameters.builder(mutableComment);

    if (StringUtils.isNotBlank(body)) {
      builder.body(body);
    }
    String groupLevel = (String) commentParams.get(PARAM_GROUP_LEVEL);
    String roleLevelIdStr = (String) commentParams.get(PARAM_ROLE_LEVEL);
    builder.visibility(Visibilities.fromGroupAndStrRoleId(groupLevel, roleLevelIdStr));
    builder.commentProperties(getCommentPropertiesQuietly(commentParams));

    final CommentService.CommentUpdateValidationResult validationResult =
        commentService.validateCommentUpdate(user, commentId, builder.build());
    if (validationResult.isValid()) {
      commentService.update(user, validationResult, true);
      issueChangeHolder.setComment(mutableComment);
    } else {
      log.error(
          "Error updating comment id '"
              + commentId
              + "' Error(s): '"
              + errorCollection.toString()
              + "'");
    }
  }
  private void createComment(
      Issue issue,
      IssueChangeHolder issueChangeHolder,
      Map<String, Object> commentParams,
      String body) {
    String groupLevel = (String) commentParams.get(PARAM_GROUP_LEVEL);
    String roleLevelIdStr = (String) commentParams.get(PARAM_ROLE_LEVEL);
    final Visibility visibility = Visibilities.fromGroupAndStrRoleId(groupLevel, roleLevelIdStr);

    final ApplicationUser user = authenticationContext.getUser();

    final CommentParameters commentParameters =
        CommentParameters.builder()
            .author(user)
            .body(body)
            .commentProperties(getCommentPropertiesQuietly(commentParams))
            .visibility(visibility)
            .issue(issue)
            .build();

    final CommentService.CommentCreateValidationResult validationResult =
        commentService.validateCommentCreate(user, commentParameters);

    if (validationResult.isValid()) {
      Comment comment = commentService.create(user, validationResult, false);
      issueChangeHolder.setComment(comment);
    } else {
      log.error(
          "There was an error creating a comment value: "
              + validationResult.getErrorCollection().toString());
    }
  }
  @Override
  public void validateParams(
      OperationContext operationContext,
      ErrorCollection errorCollectionToAddTo,
      I18nHelper i18n,
      Issue issue,
      FieldScreenRenderLayoutItem fieldScreenRenderLayoutItem) {
    Map fieldValuesHolder = operationContext.getFieldValuesHolder();
    Map<String, Object> commentParams = (Map<String, Object>) fieldValuesHolder.get(getId());
    String body = (String) commentParams.get(getId());

    String groupLevel = (String) commentParams.get(PARAM_GROUP_LEVEL);
    String roleLevel = (String) commentParams.get(PARAM_ROLE_LEVEL);
    Visibility visibility = Visibilities.fromGroupAndStrRoleId(groupLevel, roleLevel);

    ApplicationUser user = authenticationContext.getUser();

    if (commentParams.containsKey(EDIT_COMMENT)) {
      validateEditComment(errorCollectionToAddTo, issue, commentParams, body, visibility, user);
    } else if (commentParams.containsKey(REMOVE_COMMENT)) {
      validateRemoveComment(errorCollectionToAddTo, commentParams, user);
    } else {
      validateCreateComment(errorCollectionToAddTo, issue, commentParams, body, visibility, user);
    }
  }