protected function handleResponseContent(ResponseInterface $response, $contentType = null)
    {
        $contents = $response->getBody()->getContents();

        if (!$contentType) {
            $contentTypeHeaderLine = $response->getHeaderLine('Content-Type');

            if (stripos($contentTypeHeaderLine, 'application/json') !== false) {
                $contentType = 'json';
            } elseif (stripos($contentTypeHeaderLine, 'application/xml') !== false) {
                $contentType = 'xml';
            }
        }

        if ($contentType) {
            return Parser::data($contents)->from($contentType)->toArray();
        }

        return $contents;
    }