private void deleteSelectedComments() {
    if (!NetworkUtils.checkConnection(getActivity())) return;

    final CommentList selectedComments = getCommentAdapter().getSelectedComments();
    getActivity().showDialog(CommentDialogs.ID_COMMENT_DLG_TRASHING);
    CommentActions.OnCommentsModeratedListener listener =
        new CommentActions.OnCommentsModeratedListener() {
          @Override
          public void onCommentsModerated(final CommentList deletedComments) {
            if (!hasActivity()) return;
            finishActionMode();
            dismissDialog(CommentDialogs.ID_COMMENT_DLG_TRASHING);
            if (deletedComments.size() > 0) {
              getCommentAdapter().clearSelectedComments();
              getCommentAdapter().deleteComments(deletedComments);
              if (mOnCommentChangeListener != null)
                mOnCommentChangeListener.onCommentChanged(
                    ChangedFrom.COMMENT_LIST, ChangeType.TRASHED);
            } else {
              ToastUtils.showToast(getActivity(), R.string.error_moderate_comment);
            }
          }
        };

    CommentActions.moderateComments(
        WordPress.getCurrentLocalTableBlogId(), selectedComments, CommentStatus.TRASH, listener);
  }
  private void moderateSelectedComments(final CommentStatus newStatus) {
    final CommentList selectedComments = getCommentAdapter().getSelectedComments();
    final CommentList updateComments = new CommentList();

    // build list of comments whose status is different than passed
    for (Comment comment : selectedComments) {
      if (comment.getStatusEnum() != newStatus) updateComments.add(comment);
    }
    if (updateComments.size() == 0) return;

    if (!NetworkUtils.checkConnection(getActivity())) return;

    final int dlgId;
    switch (newStatus) {
      case APPROVED:
        dlgId = CommentDialogs.ID_COMMENT_DLG_APPROVING;
        break;
      case UNAPPROVED:
        dlgId = CommentDialogs.ID_COMMENT_DLG_UNAPPROVING;
        break;
      case SPAM:
        dlgId = CommentDialogs.ID_COMMENT_DLG_SPAMMING;
        break;
      case TRASH:
        dlgId = CommentDialogs.ID_COMMENT_DLG_TRASHING;
        break;
      default:
        return;
    }
    getActivity().showDialog(dlgId);

    CommentActions.OnCommentsModeratedListener listener =
        new CommentActions.OnCommentsModeratedListener() {
          @Override
          public void onCommentsModerated(final CommentList moderatedComments) {
            if (!hasActivity()) return;
            finishActionMode();
            dismissDialog(dlgId);
            if (moderatedComments.size() > 0) {
              getCommentAdapter().clearSelectedComments();
              getCommentAdapter().replaceComments(moderatedComments);
              if (mOnCommentChangeListener != null) {
                ChangeType changeType =
                    (newStatus == CommentStatus.TRASH ? ChangeType.TRASHED : ChangeType.STATUS);
                mOnCommentChangeListener.onCommentChanged(ChangedFrom.COMMENT_LIST, changeType);
              }
            } else {
              ToastUtils.showToast(getActivity(), R.string.error_moderate_comment);
            }
          }
        };

    CommentActions.moderateComments(
        WordPress.getCurrentLocalTableBlogId(), updateComments, newStatus, listener);
  }