public ActionResult Register(string ReturnUrl, AccountRegistrationViewModel model)
        {
            try
            {
                var orderConfiguration = Utilities.GetCurrentMarket().Configuration.Orders;

                // Save the customer
                var request = new CreateCustomerRequest(); //removed model.middlename because is not used in project JWJ 02July2015
                request.FirstName = model.FirstName;
                request.LastName = model.LastName;
                request.Email = model.Username;
                request.Phone = model.PhoneNumber;

                request.CanLogin = true;
                request.LoginName = model.Username;
                request.LoginPassword = model.Password;
                request.CustomerType = CustomerTypes.RetailCustomer;

                request.CustomerStatus = CustomerStatuses.Active;

                request.InsertEnrollerTree = true;
                request.EnrollerID = (model.EnrollerID != 0) ? model.EnrollerID : Identity.Owner.CustomerID;
                request.SponsorID = Identity.Owner.CustomerID;
                request.InsertUnilevelTree = true;
                request.EntryDate = DateTime.Now;
                request.DefaultWarehouseID = orderConfiguration.WarehouseID;
                request.CurrencyCode = orderConfiguration.CurrencyCode;
                request.LanguageID = orderConfiguration.LanguageID;

                var response = Exigo.WebService().CreateCustomer(request);

                // Sign the customer into their backoffice
                var service = new IdentityService();
                service.SignIn(model.Username, model.Password);

                if (ReturnUrl.IsNotEmpty()) return Redirect(ReturnUrl);
                else return RedirectToAction("index", "account", new { webalias = Identity.Owner.WebAlias });
            }
            catch (Exception e)
            {
                ViewBag.Error = e.Message;
                if (ReturnUrl.IsNotEmpty()) return RedirectToAction("register", "account", new { success = false, ReturnUrl = ReturnUrl, webalias = Identity.Owner.WebAlias });
                else return RedirectToAction("register", "account", new { success = false, webalias = Identity.Owner.WebAlias });

            }
        }
        public ActionResult Register(string ReturnUrl)
        {
            var model = new AccountRegistrationViewModel();

            return View(model);
        }