public async Task <PolicyQuoteViewModel> Get(Guid id)
        {
            var result = await _service.GetPolicyQuoteById(id);

            return(new PolicyQuoteViewModel {
                Id = result.Id, CreationDate = result.CreationDate, IsActive = result.IsActive, Number = result.Number, Price = result.Price
            });
        }
        public async Task <CheckoutSummary> CheckoutQuote(string userId)
        {
            var result = new CheckoutSummary();

            result.Date      = DateTime.UtcNow;
            result.Artifacts = new List <CheckoutArtifact>();

            //call user actor to get the basket
            IProfile userActor            = GetUserActor(userId);
            Dictionary <Guid, int> basket = await userActor.GetQuote();

            //get catalog client
            IPolicyArtifactService catalogService = GetPolicyArtifactService();

            //constuct CheckoutProduct items by calling to the catalog
            foreach (KeyValuePair <Guid, int> basketLine in basket)
            {
                PolicyArtifact artifact = await catalogService.GetPolicyQuoteById(basketLine.Key);

                var checkoutProduct = new CheckoutArtifact
                {
                    Artifact = artifact,
                    Price    = artifact.Price,
                    Quantity = basketLine.Value
                };
                result.Artifacts.Add(checkoutProduct);
            }

            //generate total price
            result.TotalPrice = result.Artifacts.Sum(p => p.Price);

            //clear user basket
            await userActor.ClearQuote();

            await AddToHistory(result);

            return(result);
        }