private OfferListViewModel OffersToOfferListViewModel(OfferListPart offerListPart, Offers offers)
        {
            var offerListViewModel = new OfferListViewModel { Title = offerListPart.Title };
            if (offers == null || offers.Offer == null)
                return offerListViewModel;

            var offer = offers.Offer.FirstOrDefault(o => o.ProductOffers != null && o.ProductOffers.ProductOffer != null && o.ProductOffers.ProductOffer.Length > 0) ??
                        offers.Offer[0];
            offerListViewModel.Title = offerListPart.Title;
            offerListViewModel.Id = offer.Id;
            offerListViewModel.Name = offer.Name;
            offerListViewModel.Type = offer.Type;
            offerListViewModel.Image = offer.Image;
            offerListViewModel.SalesPitch = offer.SalesPitch;
            if (offer.ProductOffers == null || offer.ProductOffers.ProductOffer == null)
                return offerListViewModel;

            if (offer.ProductOffers.ProductOffer.Length > offerListPart.MaxNProducts)
            {
                var limitedProductOffers = new ProductOffer[offerListPart.MaxNProducts];
                for (var i = 0; i < offerListPart.MaxNProducts; i++)
                    limitedProductOffers[i] = offer.ProductOffers.ProductOffer[i];
                offerListViewModel.ProductOfferViewModels = limitedProductOffers.Select(po => ProductOfferToProductOfferViewModel(offer.Id, po)).ToArray();
            }
            else
                offerListViewModel.ProductOfferViewModels = offer.ProductOffers.ProductOffer.Select(po => ProductOfferToProductOfferViewModel(offer.Id, po)).ToArray();
            return offerListViewModel;
        }
 private ProductOfferViewModel ProductOfferToProductOfferViewModel(long offerId, ProductOffer productOffer)
 {
     var productOfferViewModel = new ProductOfferViewModel();
     productOfferViewModel.InjectFrom(productOffer);
     if (productOffer.Product != null)
     {
         productOfferViewModel.ProductLink = _linkGenerator.GenerateProductLink(productOffer.Product.Id);
         productOfferViewModel.AddToCartLink = MakeAddToCartLink(productOffer.Product.Id, offerId);
     }
     return productOfferViewModel;
 }