protected function getResourceForResponse($response)
    {
        $api_response = new \GoCardlessPro\Core\ApiResponse($response);
        $unenveloped_body = $this->getUnenvelopedBody($api_response->body);

        if(is_array($unenveloped_body)) {
            return new ListResponse($unenveloped_body, $this->resource_class, $api_response);
        } else {
            $rclass = $this->resource_class;
            return new $rclass($unenveloped_body, $api_response);
        }
    }