public Customer CreateCustomer(string invoiceNumber, IOrderAddress address)
 {
     //Due to the limitations in API and error handling from authorized.net,
     //this is the only way I found to create or get customers if already exists.
     try
     {
         return(Gateway.CreateCustomer(address.Email,
                                       $"{address.FirstName} {address.LastName}", invoiceNumber));
     }
     catch (System.Exception ex)
     {
         if (!ex.Message.Contains("E00039"))
         {
             throw new PaymentException(PaymentException.ErrorType.ProviderError, string.Empty, ex.Message, ex);
         }
         //gets the customer id when it's duplicated
         var profileId = Regex.Match(ex.Message, @"ID (\d+)").Groups[1].Value;
         return(GetCustomer(profileId));
     }
 }