internal static IEnumerable <T> ParseGetSearchResponse <T>(HttpResponseMessage response)
        {
            if (response == null)
            {
                throw new ArgumentNullException("response", "The http response message to parse cannot be null.");
            }

            if (response.IsSuccessStatusCode)
            {
                CommandHelpers.UpdateSessionDataCookieFromResponse(response);

                return(JsonConvert.DeserializeObject <IEnumerable <T> >(response.Content.ReadAsStringAsync().Result));
            }
            else
            {
                throw new InfobloxCustomException(response);
            }
        }
        internal static string ParsePostPutDeleteResponse(HttpResponseMessage response)
        {
            if (response == null)
            {
                throw new ArgumentNullException("response", "The http response message to parse cannot be null.");
            }

            if (response.IsSuccessStatusCode)
            {
                CommandHelpers.UpdateSessionDataCookieFromResponse(response);

                return(response.Content.ReadAsStringAsync().Result.Replace("\"", ""));
            }
            else
            {
                throw new InfobloxCustomException(response);
            }
        }
        internal static object ParseGetResponse(HttpResponseMessage response, Type type)
        {
            if (response == null)
            {
                throw new ArgumentNullException("response", "The http response message to parse cannot be null.");
            }

            if (type == null)
            {
                throw new ArgumentNullException("type", "The type to parse the response message to cannot be null");
            }

            if (response.IsSuccessStatusCode)
            {
                CommandHelpers.UpdateSessionDataCookieFromResponse(response);

                return(JsonConvert.DeserializeObject(response.Content.ReadAsStringAsync().Result.Trim(_charsToTrim), type));
            }
            else
            {
                throw new InfobloxCustomException(response);
            }
        }