public function sendHeaders(SendResponseEvent $e)
    {
        $response = $e->getResponse();
        if (!$response instanceof ApiProblemResponse) {
            return $this;
        }

        /** @var Request $request */
        $request  = $this->getMvcEvent()->getRequest();

        /** @var Accept $accept */
        $accept = $request->getHeader('Accept');

        if ($accept instanceof Accept && $accept->hasMediaType('text/xml')) {
            $headers = $response->getHeaders();

            if ($headers->has('content-type')) {
                $contentTypeHeader = $headers->get('content-type');
                $headers->removeHeader($contentTypeHeader);
            }
            $headers->addHeaderLine('content-type', 'text/xml');

            if ($this->applicationResponse instanceof HttpResponse) {
                $this->mergeHeaders($this->applicationResponse, $response);
            }
        }

        return parent::sendHeaders($e);
    }