public Customer FindAcumaticaCustomer(ShopifyCustomer shopifyCustomer) { var customersByIdJson = _customerClient.SearchCustomerByCustomerId(shopifyCustomer.ShopifyCustomerId.ToString()); var customersById = customersByIdJson.DeserializeFromJson <List <Customer> >(); if (customersById.Count == 1) { return(customersById.First()); } var customersByEmailJson = _customerClient.SearchCustomerByEmail(shopifyCustomer.ShopifyPrimaryEmail); var customers = customersByEmailJson.DeserializeFromJson <List <Customer> >(); if (customers.Count == 0) { return(null); } if (customers.Count == 1) { _logService.Log(LogBuilder.FoundAcumaticaCustomerByEmail(shopifyCustomer.ShopifyPrimaryEmail)); } else { _logService.Log(LogBuilder.MultipleCustomersWithSameEmail(shopifyCustomer.ShopifyPrimaryEmail)); } return(customers.First()); }