public async Task <CustomerAddress> Address(string id) { REPO.Customer _cust = (from c in context.Customers where c.CustomerNumber == id select c).FirstOrDefault(); IEnumerable <REPO.Address> _addresses = _cust.Addresses.Where(a => a.AddressTypeCode == "01" || a.AddressTypeCode == "02"); CustomerAddress _custsaddr = new CustomerAddress(); _custsaddr.CustomerNumber = _cust.CustomerNumber; foreach (REPO.Address a in _addresses) { this.TransformAddress(a, _custsaddr); } ServicePartitionClient <HttpCommunicationClient> partitionClient = new ServicePartitionClient <HttpCommunicationClient>(communicationFactory, serviceUri, new ServicePartitionKey()); await partitionClient.InvokeWithRetryAsync( async (client) => { IEnumerable <Code> _request = CollectionBuilder.BuildAddressCodesRequest(_custsaddr); HttpResponseMessage response = await client.HttpClient.PostAsJsonAsync(new Uri(client.Url, "Services/Codes"), _request); IEnumerable <Code> _codes = await response.Content.ReadAsAsync <IEnumerable <Code> >(); _custsaddr = this.AddEnterpriseCodesToAddress(_custsaddr, _codes); }); return(_custsaddr); }