/// <summary>
        /// Load data from a subscription node
        /// </summary>
        /// <param name="subscriptionNode">The subscription node</param>
        private void LoadFromNode(XmlNode subscriptionNode)
        {
            foreach (XmlNode dataNode in subscriptionNode.ChildNodes)
            {
                switch (dataNode.Name)
                {
                    case IDKey:
                        _subscriptionID = dataNode.GetNodeContentAsInt();
                        break;
                    case StateKey:
                        _state = dataNode.GetNodeContentAsSubscriptionState();
                        break;
                    case CancellationMessageKey:
                        _cancellationMessage = dataNode.GetNodeContentAsString();
                        break;
                    case BalanceInCentsKey:
                        _balanceInCents = dataNode.GetNodeContentAsInt();
                        break;
                    case CreatedAtKey:
                        _created = dataNode.GetNodeContentAsDateTime();
                        break;
                    case CurrentPeriodStartedAtKey:
                        _currentPeriodStartedAt = dataNode.GetNodeContentAsDateTime();
                        break;
                    case CurrentPeriodEndsAtKey:
                        _currentPeriodEndsAt = dataNode.GetNodeContentAsDateTime();
                        break;
                    case NextAssessmentAtKey:
                        _nextAssessmentAt = dataNode.GetNodeContentAsDateTime();
                        break;
                    case TrialStartedAtKey:
                        _trialStartedAt = dataNode.GetNodeContentAsDateTime();
                        break;
                    case TrialEndedAtKey:
                        _trialEndedAt = dataNode.GetNodeContentAsDateTime();
                        break;
                    case UpdatedAtKey:
                        _lastUpdated = dataNode.GetNodeContentAsDateTime();
                        break;
                    case ActivatedAtKey:
                        _activatedAt = dataNode.GetNodeContentAsDateTime();
                        break;
                    case ExpiresAtKey:
                        _expiresAt = dataNode.GetNodeContentAsDateTime();
                        break;
                    case CancelAtEndOfPeriodKey:
                        _cancelAtEndOfPeriod = dataNode.GetNodeContentAsBoolean();
                        break;
                    case SignupPaymentIDKey:
                        _signupPaymentID = dataNode.GetNodeContentAsInt();
                        break;
                    case SignupRevenueKey:
                        _signupRevenue = dataNode.GetNodeContentAsDecimal();
                        break;
                    case DelayedCancelAtKey:
                        _delayedCancelAt = dataNode.GetNodeContentAsDateTime();
                        break;
                    case PreviousStateKey:
                        _previousState = dataNode.GetNodeContentAsSubscriptionState();
                        break;
                    case CanceledAtKey:
                        _canceledAt = dataNode.GetNodeContentAsDateTime();
                        break;
                    case CouponCodeKey:
                        _couponCode = dataNode.GetNodeContentAsString();
                        break;
                    case ProductKey:
                        _product = dataNode.GetNodeContentAsProduct();
                        break;
                    case TotalRevenueInCentsKey:
                        _totalRevenueInCents = dataNode.GetNodeContentAsInt();
                        break;
                    case PaymentCollectionMethodKey:
                        _paymentCollectionMethod = dataNode.GetNodeContentAsPaymentCollectionMethod();
                        break;
                    case ProductVersionNumberKey:
                        _productVersionNumber = dataNode.GetNodeContentAsInt();
                        break;
                    case ProductPriceInCentsKey:
                        _productPriceInCents = dataNode.GetNodeContentAsInt();
                        break;
                    case PaymentProfileAsBankAccountKey:
                        if (dataNode.FirstChild != null)
                        {
                            // create new credit card view object.
                            _paymentProfile = new PaymentProfileView();
                            // There's no constructor that takes in an XmlNode, so parse it here.
                            foreach (XmlNode childNode in dataNode.ChildNodes)
                            {
                                switch (childNode.Name)
                                {                            
                                    case "first_name":
                                        _paymentProfile.FirstName = childNode.GetNodeContentAsString();
                                        break;
                                    case "last_name":
                                        _paymentProfile.LastName = childNode.GetNodeContentAsString();
                                        break;
                                    case "billing_address":
                                        _paymentProfile.BillingAddress = childNode.GetNodeContentAsString();
                                        break;
                                    case "billing_address_2":
                                        _paymentProfile.BillingAddress2 = childNode.GetNodeContentAsString();
                                        break;
                                    case "billing_city":
                                        _paymentProfile.BillingCity = childNode.GetNodeContentAsString();
                                        break;
                                    case "billing_state":
                                        _paymentProfile.BillingState = childNode.GetNodeContentAsString();
                                        break;
                                    case "billing_zip":
                                        _paymentProfile.BillingZip = childNode.GetNodeContentAsString();
                                        break;
                                    case "billing_country":
                                        _paymentProfile.BillingCountry = childNode.GetNodeContentAsString();
                                        break;
                                    case "bank_account_holder_type":
                                        _paymentProfile.BankAccountHolderType = childNode.GetNodeContentAsEnum<BankAccountHolderType>();
                                        break;
                                    case "bank_account_type":
                                        _paymentProfile.BankAccountType = childNode.GetNodeContentAsEnum<BankAccountType>();
                                        break;
                                    case "bank_name":
                                        _paymentProfile.BankName = childNode.GetNodeContentAsString();
                                        break;
                                    case "masked_bank_account_number":
                                        _paymentProfile.MaskedBankAccountNumber = childNode.GetNodeContentAsString();
                                        break;
                                    case "masked_bank_routing_number":
                                        _paymentProfile.MaskedBankRoutingNumber = childNode.GetNodeContentAsString();
                                        break;
                                    case "payment_type":
                                        _paymentProfile.CardType = childNode.GetNodeContentAsString();
                                        break;
                                    case "id":
                                        _paymentProfile.Id = childNode.GetNodeContentAsInt();
                                        break;
                                    // TODO
                                    case "current_vault":
                                    case "customer_id":
                                    case "customer_vault_token":
                                    case "vault_token":
                                        break;
                                }
                            }
                        }
                        else
                            _paymentProfile = null;
                        break;
                    case PaymentProfileAsCreditCardKey:
                        if (dataNode.FirstChild != null)
                        {
                            // create new credit card view object.
                            _paymentProfile = new PaymentProfileView();
                            // There's no constructor that takes in an XmlNode, so parse it here.
                            foreach (XmlNode childNode in dataNode.ChildNodes)
                            {
                                switch (childNode.Name)
                                {
                                    case "id":
                                        _paymentProfile.Id = childNode.GetNodeContentAsInt();
                                        break;
                                    case "type":
                                        _paymentProfile.CardType = childNode.GetNodeContentAsString();
                                        break;
                                    case "expiration_month":
                                        _paymentProfile.ExpirationMonth = childNode.GetNodeContentAsInt();
                                        break;
                                    case "expiration_year":
                                        _paymentProfile.ExpirationYear = childNode.GetNodeContentAsInt();
                                        break;
                                    case "first_name":
                                        _paymentProfile.FirstName = childNode.GetNodeContentAsString();
                                        break;
                                    case "last_name":
                                        _paymentProfile.LastName = childNode.GetNodeContentAsString();
                                        break;
                                    case "masked_card_number":
                                        _paymentProfile.FullNumber = childNode.GetNodeContentAsString();
                                        break;
                                    case "billing_address":
                                        _paymentProfile.BillingAddress = childNode.GetNodeContentAsString();
                                        break;
                                    case "billing_address_2":
                                        _paymentProfile.BillingAddress2 = childNode.GetNodeContentAsString();
                                        break;
                                    case "billing_city":
                                        _paymentProfile.BillingCity = childNode.GetNodeContentAsString();
                                        break;
                                    case "billing_state":
                                        _paymentProfile.BillingState = childNode.GetNodeContentAsString();
                                        break;
                                    case "billing_zip":
                                        _paymentProfile.BillingZip = childNode.GetNodeContentAsString();
                                        break;
                                    case "billing_country":
                                        _paymentProfile.BillingCountry = childNode.GetNodeContentAsString();
                                        break;
                                    // TODO
                                    case "current_vault":
                                    case "customer_id":
                                    case "customer_vault_token":
                                    case "vault_token":
                                        break;
                                }
                            }
                        }
                        else
                            _paymentProfile = null;
                        break;
                    case CustomerKey:
                        _customer = dataNode.GetNodeContentAsCustomer();
                        break;
                    default:
                        break;

                }
            }
        }
 /// <summary>
 /// Load data from a JsonObject
 /// </summary>
 /// <param name="obj">The JsonObject containing subscription data</param>
 private void LoadFromJSON(JsonObject obj)
 {
     foreach (string key in obj.Keys)
     {
         switch (key)
         {
             case IDKey:
                 _subscriptionID = obj.GetJSONContentAsInt(key);
                 break;
             case StateKey:
                 _state = obj.GetJSONContentAsSubscriptionState(key);
                 break;
             case CancellationMessageKey:
                 _cancellationMessage = obj.GetJSONContentAsString(key);
                 break;
             case BalanceInCentsKey:
                 _balanceInCents = obj.GetJSONContentAsInt(key);
                 break;
             case CreatedAtKey:
                 _created = obj.GetJSONContentAsDateTime(key);
                 break;
             case CurrentPeriodStartedAtKey:
                 _currentPeriodStartedAt = obj.GetJSONContentAsDateTime(key);
                 break;
             case CurrentPeriodEndsAtKey:
                 _currentPeriodEndsAt = obj.GetJSONContentAsDateTime(key);
                 break;
             case NextAssessmentAtKey:
                 _nextAssessmentAt = obj.GetJSONContentAsDateTime(key);
                 break;
             case TrialStartedAtKey:
                 _trialStartedAt = obj.GetJSONContentAsDateTime(key);
                 break;
             case TrialEndedAtKey:
                 _trialEndedAt = obj.GetJSONContentAsDateTime(key);
                 break;
             case UpdatedAtKey:
                 _lastUpdated = obj.GetJSONContentAsDateTime(key);
                 break;
             case ActivatedAtKey:
                 _activatedAt = obj.GetJSONContentAsDateTime(key);
                 break;
             case ExpiresAtKey:
                 _expiresAt = obj.GetJSONContentAsDateTime(key);
                 break;
             case CancelAtEndOfPeriodKey:
                 _cancelAtEndOfPeriod = obj.GetJSONContentAsBoolean(key);
                 break;
             case SignupPaymentIDKey:
                 _signupPaymentID = obj.GetJSONContentAsInt(key);
                 break;
             case SignupRevenueKey:
                 _signupRevenue = obj.GetJSONContentAsDecimal(key);
                 break;
             case DelayedCancelAtKey:
                 _delayedCancelAt = obj.GetJSONContentAsDateTime(key);
                 break;
             case PreviousStateKey:
                 _previousState = obj.GetJSONContentAsSubscriptionState(key);
                 break;
             case CanceledAtKey:
                 _canceledAt = obj.GetJSONContentAsDateTime(key);
                 break;
             case CouponCodeKey:
                 _couponCode = obj.GetJSONContentAsString(key);
                 break;
             case ProductKey:
                 _product = obj.GetJSONContentAsProduct(key);
                 break;
             case TotalRevenueInCentsKey:
                 _totalRevenueInCents = obj.GetJSONContentAsInt(key);
                 break;
             case PaymentCollectionMethodKey:
                 _paymentCollectionMethod = obj.GetJSONContentAsPaymentCollectionMethod(key);
                 break;
             case ProductVersionNumberKey:
                 _productVersionNumber = obj.GetJSONContentAsInt(key);
                 break;
             case ProductPriceInCentsKey:
                 _productPriceInCents = obj.GetJSONContentAsInt(key);
                 break;
             case PaymentProfileAsBankAccountKey:
                 // create new bank account view object.
                 _paymentProfile = new PaymentProfileView();
                 JsonObject viewObj = obj[key] as JsonObject;
                 if (viewObj != null)
                 {
                     foreach (string viewKey in viewObj.Keys)
                     {
                         switch (viewKey)
                         {
                             case "first_name":
                                 _paymentProfile.FirstName = viewObj.GetJSONContentAsString(viewKey);
                                 break;
                             case "last_name":
                                 _paymentProfile.LastName = viewObj.GetJSONContentAsString(viewKey);
                                 break;
                             case "billing_address":
                                 _paymentProfile.BillingAddress = viewObj.GetJSONContentAsString(viewKey);
                                 break;
                             case "billing_address_2":
                                 _paymentProfile.BillingAddress2 = viewObj.GetJSONContentAsString(viewKey);
                                 break;
                             case "billing_city":
                                 _paymentProfile.BillingCity = viewObj.GetJSONContentAsString(viewKey);
                                 break;
                             case "billing_state":
                                 _paymentProfile.BillingState = viewObj.GetJSONContentAsString(viewKey);
                                 break;
                             case "billing_zip":
                                 _paymentProfile.BillingZip = viewObj.GetJSONContentAsString(viewKey);
                                 break;
                             case "billing_country":
                                 _paymentProfile.BillingCountry = viewObj.GetJSONContentAsString(viewKey);
                                 break;
                             case "bank_account_holder_type":
                                 _paymentProfile.BankAccountHolderType = viewObj.GetJSONContentAsEnum<BankAccountHolderType>(viewKey);
                                 break;
                             case "bank_account_type":
                                 _paymentProfile.BankAccountType = viewObj.GetJSONContentAsEnum<BankAccountType>(viewKey);
                                 break;
                             case "bank_name":
                                 _paymentProfile.BankName = viewObj.GetJSONContentAsString(viewKey);
                                 break;
                             case "masked_bank_account_number":
                                 _paymentProfile.MaskedBankAccountNumber = viewObj.GetJSONContentAsString(viewKey);
                                 break;
                             case "masked_bank_routing_number":
                                 _paymentProfile.MaskedBankRoutingNumber = viewObj.GetJSONContentAsString(viewKey);
                                 break;
                             case "card_type":
                                 _paymentProfile.CardType = viewObj.GetJSONContentAsString(viewKey);
                                 break;
                             case "id":
                                 _paymentProfile.Id = viewObj.GetJSONContentAsInt(viewKey);
                                 break;
                             case "current_vault":
                             case "customer_id":
                             case "customer_vault_token":
                             case "vault_token":
                                 break;
                         }
                     }
                 }
                 else
                 {
                     _paymentProfile = null;
                 }
                 break;
             case PaymentProfileAsCreditCardKey:
                 // create new credit card view object.
                 _paymentProfile = new PaymentProfileView();
                 JsonObject viewObj2 = obj[key] as JsonObject;
                 if (viewObj2 != null)
                 {
                     foreach (string viewKey in viewObj2.Keys)
                     {
                         switch (viewKey)
                         {
                             case "id":
                                 _paymentProfile.Id = viewObj2.GetJSONContentAsInt(viewKey);
                                 break;
                             case "card_type":
                                 _paymentProfile.CardType = viewObj2.GetJSONContentAsString(viewKey);
                                 break;
                             case "expiration_month":
                                 _paymentProfile.ExpirationMonth = viewObj2.GetJSONContentAsInt(viewKey);
                                 break;
                             case "expiration_year":
                                 _paymentProfile.ExpirationYear = viewObj2.GetJSONContentAsInt(viewKey);
                                 break;
                             case "first_name":
                                 _paymentProfile.FirstName = viewObj2.GetJSONContentAsString(viewKey);
                                 break;
                             case "last_name":
                                 _paymentProfile.LastName = viewObj2.GetJSONContentAsString(viewKey);
                                 break;
                             case "masked_card_number":
                                 _paymentProfile.FullNumber = viewObj2.GetJSONContentAsString(viewKey);
                                 break;
                             case "billing_address":
                                 _paymentProfile.BillingAddress = viewObj2.GetJSONContentAsString(viewKey);
                                 break;
                             case "billing_address_2":
                                 _paymentProfile.BillingAddress2 = viewObj2.GetJSONContentAsString(viewKey);
                                 break;
                             case "billing_city":
                                 _paymentProfile.BillingCity = viewObj2.GetJSONContentAsString(viewKey);
                                 break;
                             case "billing_state":
                                 _paymentProfile.BillingState = viewObj2.GetJSONContentAsString(viewKey);
                                 break;
                             case "billing_zip":
                                 _paymentProfile.BillingZip = viewObj2.GetJSONContentAsString(viewKey);
                                 break;
                             case "billing_country":
                                 _paymentProfile.BillingCountry = viewObj2.GetJSONContentAsString(viewKey);
                                 break;
                         }
                     }
                 }
                 else
                 {
                     _paymentProfile = null;
                 }
                 break;
             case CustomerKey:
                 _customer = obj.GetJSONContentAsCustomer(key);
                 break;
             default:
                 break;
         }
     }
 }