protected function prepareResponse($responseRaw, RestRequest $request)
    {
        $body = (string) $responseRaw->getBody();
        
        $parsedResult = json_decode($body);
        if ($parsedResult == false) {
            $parsedResult = new \stdClass();
        }
        
        $response = new RestResponse($responseRaw->getStatusCode(), $body, $parsedResult, $request);
        
        return $response;
    }