public static bool TryGetSubscriptionException(ErrorResponseException ere, out SubscriptionException subscriptionException)
        {
            var text = ere.ResponseString;

            if (ere.StatusCode == SubscriptionDoesNotExistException.RelevantHttpStatusCode)
            {
                var errorResult = JsonConvert.DeserializeAnonymousType(text, new
                {
                    url   = (string)null,
                    error = (string)null
                });

                subscriptionException = new SubscriptionDoesNotExistException(errorResult.error);
                return(true);
            }

            if (ere.StatusCode == SubscriptionInUseException.RelavantHttpStatusCode)
            {
                var errorResult = JsonConvert.DeserializeAnonymousType(text, new
                {
                    url   = (string)null,
                    error = (string)null
                });

                subscriptionException = new SubscriptionInUseException(errorResult.error);
                return(true);
            }

            if (ere.StatusCode == SubscriptionClosedException.RelevantHttpStatusCode)
            {
                var errorResult = JsonConvert.DeserializeAnonymousType(text, new
                {
                    url   = (string)null,
                    error = (string)null
                });

                subscriptionException = new SubscriptionClosedException(errorResult.error);
                return(true);
            }

            subscriptionException = null;
            return(false);
        }
        public static bool TryGetSubscriptionException(ErrorResponseException ere, out SubscriptionException subscriptionException)
        {
            if (ere.StatusCode == SubscriptionDoesNotExistExeption.RelevantHttpStatusCode)
            {
                subscriptionException = new SubscriptionDoesNotExistExeption(ere.ResponseString);
                return(true);
            }

            if (ere.StatusCode == SubscriptionInUseException.RelavantHttpStatusCode)
            {
                subscriptionException = new SubscriptionInUseException(ere.Message);
                return(true);
            }

            if (ere.StatusCode == SubscriptionClosedException.RelevantHttpStatusCode)
            {
                subscriptionException = new SubscriptionClosedException(ere.Message);
                return(true);
            }

            subscriptionException = null;
            return(false);
        }