protected function parseRequestContent($content, $type)
    {
        $content = json_decode($content, true);
        if (empty($content['data'])) {
            throw new Exception(
                'Payload either contains misformed JSON or missing "data" parameter.',
                static::ERROR_SCOPE | static::ERROR_INVALID_ATTRS,
                BaseResponse::HTTP_BAD_REQUEST
            );
        }

        $data = $content['data'];
        if (!isset($data['type'])) {
            throw new Exception(
                '"type" parameter not set in request.',
                static::ERROR_SCOPE | static::ERROR_INVALID_ATTRS,
                BaseResponse::HTTP_BAD_REQUEST
            );
        }
        if ($data['type'] !== $type) {
            throw new Exception(
                '"type" parameter is not valid. Expecting ' . $type,
                static::ERROR_SCOPE | static::ERROR_INVALID_ATTRS,
                BaseResponse::HTTP_CONFLICT
            );
        }
        unset($data['type']);

        return $data;
    }