public function checkAcceptHeader(Request $request)
    {
        $headers = $request->getAcceptableContentTypes();

        if (array_intersect($headers, ['application/json', 'text/json'])) {
            return 'json';
        } elseif (array_intersect($headers, ['application/xml', 'text/xml'])) {
            return 'xml';
        }

        return $this->defaultAcceptType;
    }