/// <summary>
 /// Returns a <see cref="RestSharpException"/> exception if the response was not successful
 /// </summary>
 public static Exception GetException(this IRestResponse response)
 {
     if (response.IsSuccessful())
     {
         return(null);
     }
     else
     {
         return(new RestSharpException(response.StatusCode, response.ResponseUri, response.Content, response.GetError(), response.ErrorException));
     }
 }