protected function getRequestJson()
    {
        if ($this->request->getContentType() !== 'json') {
            throw new UserMessageException(t('Invalid request Content-Type: %s', $this->request->headers->get('Content-Type', '')), Response::HTTP_NOT_ACCEPTABLE);
        }
        $contentBody = $this->request->getContent();
        $contentJson = @json_decode($contentBody, true);
        if (!is_array($contentJson)) {
            throw new UserMessageException(t('Failed to parse the request body as JSON'), Response::HTTP_NOT_ACCEPTABLE);
        }

        return $contentJson;
    }