public async Task<ActionResult> AddItemToCart(int id, int wishlistItemId) {
            var isInCart = await _db.CartItems.AnyAsync(ci => ci.CartId == id && ci.Item.Id == wishlistItemId);

            if (isInCart) {
                return Json(new { WasInCart = true });
            }

            var item = await _db.WishlistItems.FindAsync(wishlistItemId);
            var retailer = new AmazonRetailer(AmazonAssociateTag, AmazonAccessKey, "AWSECommerceServicePort");
            var retailItem = (await retailer.LookupItemsAsync(new[] { item.ItemId })).FirstOrDefault();
            var cart = await _db.Carts.FindAsync(id);

            var cartItem = new CartItem {
                Cart = cart,
                Item = item,
                Price = retailItem.ListPrice,
                Title = retailItem.Title
            };

            _db.CartItems.Add(cartItem);
            await _db.SaveChangesAsync();

            return Json(new { IsInCart = true });
        }
        private async Task<IList<Item>> LookupItems(IEnumerable<WishlistItem> wishlistItems) {
            const int MaxLookupCount = 10;

            var itemIds = wishlistItems.Select(wi => wi.ItemId)
                .ToArray();
            var items = new List<Item>();
            var retailer = new AmazonRetailer(AmazonAssociateTag, AmazonAccessKey, "AWSECommerceServicePort");

            while (itemIds.Any()) {
                var lookupIds = itemIds.Take(MaxLookupCount)
                    .ToArray();
                var resultItems = await retailer.LookupItemsAsync(lookupIds);
                items.AddRange(resultItems);
                itemIds = itemIds.Skip(lookupIds.Length)
                    .ToArray();
            }

            return items;
        }