/// <summary>
        /// Profile migrate from anonymous.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="pe">The <see cref="ProfileMigrateEventArgs"/> instance containing the event data.</param>
        private void Profile_MigrateAnonymous(Object sender, ProfileMigrateEventArgs pe)
        {
            var client = ServiceLocator.Current.GetInstance<OrderClient>();
            var orders = client.GetAllCustomerOrders(pe.AnonymousID,
                                                     UserHelper.CustomerSession.StoreId);

            if (orders != null)
            {
                foreach (var order in orders)
                {
                    order.CustomerId = UserHelper.CustomerSession.CustomerId;
                    order.CustomerName = UserHelper.CustomerSession.CustomerName;
                }

                client.SaveChanges();
            }

            // Migrate shopping cart
            var cart = new CartHelper(CartHelper.CartName);
            var anonymousCart = new CartHelper(CartHelper.CartName, pe.AnonymousID);

            // Only perform merge if cart is not empty
            if (!anonymousCart.IsEmpty)
            {
                // Merge cart
                cart.Add(anonymousCart.Cart, true);
                cart.SaveChanges();

                // Delete anonymous cart
                anonymousCart.Delete();
                anonymousCart.SaveChanges();
            }

            var wishList = new CartHelper(CartHelper.WishListName);
            var anonymousWishList = new CartHelper(CartHelper.WishListName, pe.AnonymousID);

            // Only perform merge if cart is not empty
            if (!anonymousWishList.IsEmpty)
            {
                // Merge wish list
                wishList.Add(anonymousWishList.Cart, true);
                if (String.IsNullOrEmpty(wishList.Cart.BillingCurrency))
                {
                    wishList.Cart.BillingCurrency = UserHelper.CustomerSession.Currency;
                }
                wishList.SaveChanges();

                // Delete anonymous wish list
                anonymousWishList.Delete();
                anonymousWishList.SaveChanges();
            }

            //Delete the anonymous data from the database
            //ProfileManager.DeleteProfile(pe.AnonymousID);

            //Remove the anonymous identifier from the request so 
            //this event will no longer fire for a logged-in user
            AnonymousIdentificationModule.ClearAnonymousIdentifier();
        }
        public ActionResult UpdateWishList(List<LineItemUpdateModel> lineItems, string action)
        {
            var ch = new CartHelper(CartHelper.CartName);
            var helper = new CartHelper(CartHelper.WishListName);

            if (action == UserHelper.AddToCartAction)
            {
                //add all to cart
                foreach (var lineItem in lineItems)
                {
                    var li = helper.LineItems.FirstOrDefault(item => item.LineItemId == lineItem.LineItemId);

                    if (li == null)
                    {
                        continue;
                    }

                    var catalogItem = _catalogClient.GetItem(li.CatalogItemId);
                    var parentItem = _catalogClient.GetItem(li.ParentCatalogItemId);
                    ch.AddItem(catalogItem, parentItem, lineItem.Quantity, false);
                    helper.Remove(li);

                    // If wishlist is empty, remove it from the database
                    if (helper.IsEmpty)
                    {
                        helper.Delete();
                    }
                }

                ch.SaveChanges();
            }
            else
            {
                foreach (var lineItem in lineItems)
                {
                    var li = helper.LineItems.FirstOrDefault(item => item.LineItemId == lineItem.LineItemId);
                    if (li == null)
                    {
                        continue;
                    }

                    li.Comment = lineItem.Comment;
                    li.Quantity = lineItem.Quantity;
                }
            }

            helper.SaveChanges();

            return RedirectToAction("WishList");
        }