def METHOD_NAME(request, comment_pk, action):
    get_comment_with_children_filter = Q(parent_id=comment_pk) | Q(pk=comment_pk)
    comments = XtdComment.objects.filter(get_comment_with_children_filter)
    comment_moderations = []
    verb = ''
    if action == 'approve':
        for comment in comments:
            comment.is_public = True
            comment.flags.all().delete()
            comment_moderation = comment.comment_moderation
            comment_moderation.state = CommentModeration.CommentModerationState.APPROVED
            comment_moderations.append(comment_moderation)
        verb = 'approved'
    elif action == 'reject':
        for comment in comments:
            comment.is_public = False
            comment_moderation = comment.comment_moderation
            comment_moderation.state = CommentModeration.CommentModerationState.REJECTED
            comment_moderations.append(comment_moderation)
        verb = 'rejected'
    elif action == 'unsure':
        for comment in comments:
            comment_moderation = comment.comment_moderation
            comment_moderation.state = CommentModeration.CommentModerationState.UNSURE
            comment_moderations.append(comment_moderation)
        verb = 'unsure'
    elif action == 'unpublish':
        for comment in comments:
            comment.is_public = False
        verb = 'unpublished'
    elif action == 'publish':
        for comment in comments:
            comment.is_public = True
        verb = 'published'
    elif action == 'hide':
        for comment in comments:
            comment.is_removed = True
        verb = 'removed'
    elif action == 'show':
        for comment in comments:
            comment.is_removed = False
        verb = 'shown'
    elif action == 'clear_flags':
        comment = XtdComment.objects.get(pk=comment_pk)
        comment.flags.all().delete()
        verb = 'cleared'
    XtdComment.objects.bulk_update(comments, ['is_public', 'is_removed'])
    CommentModeration.objects.bulk_update(comment_moderations, ['state'])
    messages.success(request, _(f'The comment has been {verb} successfully!'))
    return redirect(request.META.get('HTTP_REFERER'))