public ViewResult ShowDetailedDescription(int productId, string returnUrl) { if (returnUrl.Contains("/Products/AjaxList")) { returnUrl = "/Products/List"; } ViewData["returnUrl"] = returnUrl; Product product = repository.Products.First(p => p.ProductID == productId); // create an instance of the recently viewed class - to store the products viewed RecentlyViewed recentViews = (RecentlyViewed)(new RecentViewsModelBinder()).BindModel(this.ControllerContext, new ModelBindingContext()); // make sure only one instance of each product is added to the view if (!recentViews.ContainsProduct(product)) { recentViews.AddRecentProduct(product); } else { recentViews.AddProductAndMove(product); } IEnumerable <int> sizeIds = product.ProductToSizes.Select(p => p.SizeId); IEnumerable <int> colorIds = product.ProductToColors.Select(p => p.ColorId); ProductInfo inf = new ProductInfo { SizeHolders = repository. Sizes.Where(p => sizeIds.Contains(p.Id)). Select(d => d.Value).ToArray(), Product = product, ColorHolders = repository. Colors.Where(p => colorIds.Contains(p.ColorId)). Select(d => d.Value).ToArray() }; return(View(inf)); }