public ManagerResponse <GetVisitorOrdersResult, IEnumerable <OrderHeader> > GetUserOrders(string userName)
        {
            if (userName == null)
            {
                throw new ArgumentNullException(nameof(userName));
            }

            var user = this.AccountManager.GetUser(userName);

            if (!user.ServiceProviderResult.Success || user.Result == null)
            {
                throw new ArgumentException("Could not find the user, invalid userName.", nameof(userName));
            }

            var request = new GetVisitorOrdersRequest(user.Result.ExternalId, StorefrontContext.Current.ShopName);
            var result  = OrderServiceProvider.GetVisitorOrders(request);

            if (result.Success && result.OrderHeaders != null && result.OrderHeaders.Count > 0)
            {
                return(new ManagerResponse <GetVisitorOrdersResult, IEnumerable <OrderHeader> >(result, result.OrderHeaders.ToList()));
            }

            result.WriteToSitecoreLog();
            //no orders found returns false - we treat it as success
            if (!result.Success && !result.SystemMessages.Any())
            {
                result.Success = true;
            }
            return(new ManagerResponse <GetVisitorOrdersResult, IEnumerable <OrderHeader> >(result, new List <OrderHeader>()));
        }
        // GET
        public ActionResult Index()
        {
            var orderService = new OrderServiceProvider();

            var visitorOrdersRequest = new GetVisitorOrdersRequest("Entity-Customer-34d758ae2d2d472d89014954d0cc4440", "CommerceEngineDefaultStorefront");

            var result = orderService.GetVisitorOrders(visitorOrdersRequest);

            return(View(result));
        }