public static taxCoreModel.TaxEvaluationContext ToTaxEvalContext(this coreModel.QuoteRequest quoteRequest) { var retVal = new taxCoreModel.TaxEvaluationContext(); retVal.Id = quoteRequest.Id; retVal.Code = quoteRequest.Number; retVal.Currency = quoteRequest.Currency; retVal.Address = quoteRequest.Addresses != null?quoteRequest.Addresses.FirstOrDefault() : null; retVal.Type = quoteRequest.GetType().Name; foreach (var quoteItem in quoteRequest.Items) { var line = new taxCoreModel.TaxLine { Id = quoteItem.Id, Code = quoteItem.Sku, Name = quoteItem.Name, TaxType = quoteItem.TaxType, Amount = quoteItem.SelectedTierPrice.Price * quoteItem.SelectedTierPrice.Quantity }; retVal.Lines.Add(line); } return(retVal); }