public long CreateCustomerProfile(string email, string description,out AuthorizeNet.APICore.messagesType messages)
 {
     long result = 0;       
     string profileId = "0";
     AuthorizeNet.APICore.customerProfileType profile = new AuthorizeNet.APICore.customerProfileType();
     profile.email = email;
     profile.description = description;
     AuthorizeNet.APICore.createCustomerProfileRequest req = new AuthorizeNet.APICore.createCustomerProfileRequest();
     req.profile = profile;
     AuthorizeNet.HttpXmlUtility util = new AuthorizeNet.HttpXmlUtility(ServiceMode, MerchantAuthenticationType.name, MerchantAuthenticationType.transactionKey);
     AuthorizeNet.APICore.createCustomerProfileResponse response = null;
     try
     {
         response = (AuthorizeNet.APICore.createCustomerProfileResponse)util.Send(req);                
         long.TryParse(response.customerProfileId, out result);
     }
     catch (System.InvalidOperationException ex)
     {
         if (ex.Message.Contains(DUPLICATE_PROFILE_MESSAGE))
         {
             
             profileId = ex.Message.Replace(DUPLICATE_PROFILE_MESSAGE, String.Empty).Replace(" already exists.", String.Empty);
             long.TryParse(profileId, out result);
         }
     }
     messages = response.messages;
     return result;
 }
        public Customer CreateCustomer(string email, string description, string merchantCustomerId)
        {
            //use the XSD class to create the profile
            var newCustomer = new customerProfileType();
            newCustomer.description = description;
            newCustomer.email = email;
            newCustomer.merchantCustomerId = merchantCustomerId;

            var req = new createCustomerProfileRequest();

            req.profile = newCustomer;

            //serialize and send
            var response = (createCustomerProfileResponse)_gateway.Send(req);

            //set the profile ID
            return new Customer
            {
                Email = email,
                Description = description,
                ProfileID = response.customerProfileId,
                ID = merchantCustomerId != "" ? merchantCustomerId : "MerchantCustomerID"
            };
        }