public function changeCommentState()
    {
        $userIsAllowed = $this
            ->userCredentialsProvider
            ->isAllowed();
        if (!$userIsAllowed) {
            return new JsonResponse([
                'status' => 'Error',
                'message' => 'The user is not allowed to do this',
            ], 401);
        }

        $userIsModerator = $this->userCredentialsProvider->isModerator();
        if (!$userIsModerator) {
            return new JsonResponse([
                'status' => 'Error',
                'message' => 'User must have the moderator role',
            ], 401);
        }

        $sourceUUID = $this->getSourceUUID();
        if (empty($sourceUUID)) {
            return new JsonResponse([
                'status' => 'Error',
                'message' => 'Source UUID header must be defined',
            ], 400);
        }

        $postParameterBag = $this
            ->request
            ->request;
        $newState = $postParameterBag->get('new_state');
        $commentId = $postParameterBag->get('comment_id');

        if (
            empty($newState) ||
            empty($commentId)
        ) {
            return new JsonResponse([
                'status' => 'Error',
                'message' => 'Some query parameters are missing',
            ], 400);
        }

        $comment = $this
            ->commentRepository
            ->findComment(new CommentUUID($commentId))
            ->getFirstComment();

        if (!$comment instanceof Comment) {
            return new JsonResponse([
                'status' => 'Error',
                'message' => 'Comment not found',
            ], 404);
        }

        $comment->setState((int) $newState);
        $this
            ->commentRepository
            ->addComment($comment);
        $this->flushRepository();

        return new JsonResponse([
            'status' => 'OK',
            'comment' => $comment->toArray(),
            'user' => $this->userCredentialsProvider->toArray(),
        ], 200);
    }