private function createNotAcceptableException(string $type): HttpException
    {
        $headers = new HttpHeaders();
        $headers->add('Content-Type', 'application/json');
        $body = new StringBody(json_encode($this->contentNegotiator->getAcceptableResponseMediaTypes($type)));
        $response = new Response(HttpStatusCodes::HTTP_NOT_ACCEPTABLE, $headers, $body);

        return new HttpException($response);
    }