public ActionResult Register(RegisterModel model)
		{
			if (ModelIsValid)
			{
				var data = model.CopyTo();
				Execute(() => _accountService.Create(data));

				if (ModelIsValid)
				{
					var activateModel = new MailActivateModel
					{
						Token = Execute(() => _accountService.GetUserActivateToken(data.Email)),
						Email = data.Email,
						Password = data.Password
					};

					if (!string.IsNullOrEmpty(activateModel.Token))
						_mailer.SendMessageAsync("ActivateAccount", activateModel, model.RegisterEmail);

					model.ReturnUrl = WebBuilder.BuildActionUrl<AccountController>(o => o.RegisterSuccessfull(model.RegisterEmail));
					return Json(model, JsonRequestBehavior.AllowGet);
				}
			}
			return View("_RegisterPartial", model);
		}
		public ActionResult ExternalRegisterConfirmation(ExternalRegisterModel model)
		{
			if (User.Identity.IsAuthenticated)
				return RedirectToAction<HomeController>(o => o.Index());

			if (ModelState.IsValid)
			{
				var data = model.CopyTo();
				Execute(() => _accountService.Create(data, true));

				if (ModelIsValid)
				{
					var activateModel = new MailActivateModel
					{
						Token = Execute(() => _accountService.GetUserActivateToken(data.Email)),
						Email = data.Email,
						Password = data.Password
					};

					if (string.IsNullOrWhiteSpace(model.ExternalPassword))
						activateModel.ProviderName = model.ProviderName;

					if (!string.IsNullOrEmpty(activateModel.Token))
						_mailer.SendMessageAsync("ActivateAccount", activateModel, model.ExternalEmail);

					return RedirectToAction<AccountController>(o => o.RegisterSuccessfull(model.ExternalEmail));
				}
			}

			return View(model);
		}
        public ActionResult SendMessageForActivate(int? userId, UsersModel model)
        {
            if (userId.HasValue)
            {
                var user = Execute(() => _accountService.GetUser(userId.GetValueOrDefault()));

                if (ModelIsValid)
                {
                    var activateModel = new MailActivateModel
                    {
                        Token = Execute(() => _accountService.GetUserActivateToken(user.Email)),
                        Email = user.Email,
                        Password = StringGeneration.Generate(8)
                    };
                    Execute(() => _accountService.SetPassword(user.Id, activateModel.Password));

                    if (ModelIsValid && !string.IsNullOrEmpty(activateModel.Token))
                        _mailer.SendMessageAsync("ActivateAccount", activateModel, user.Email);
                }
            }

            FillUsersModel(model);

            return ModelIsValid
                ? (ActionResult)View("UsersData", model)
                : JsonErrorResult();
        }