protected virtual IPurchasable SelectFromQuote(EntityReference quote, Entity purchaseMetadata = null, IEnumerable <IPurchasableItemOptions> options = null)
        {
            var requiresShipping = purchaseMetadata != null && purchaseMetadata.GetAttributeValue <bool?>(PurchaseMetadataAttributes.RequriesShipping).GetValueOrDefault(false);

            var quoteDataAdapter = new QuotePurchaseDataAdapter(quote, Dependencies, requiresShipping);

            return(quoteDataAdapter.Select(options ?? Enumerable.Empty <IPurchasableItemOptions>()));
        }
        public override void UpdateShipToAddress(IPurchaseAddress address)
        {
            if (address == null)
            {
                throw new ArgumentNullException("address");
            }

            if (WebFormSession.QuoteId == Guid.Empty)
            {
                throw new InvalidOperationException("Unable to determine quote from web form session.");
            }

            var quoteDataAdapter = new QuotePurchaseDataAdapter(new EntityReference("quote", WebFormSession.QuoteId), Dependencies);

            quoteDataAdapter.UpdateShipToAddress(address);
        }