public async Task <string> SendVerificationCode([FromBody] SendVerificationCodeViewModel model, string returnUrl = null)
        {
            //if (User.IsSignedIn())
            //{
            //  //return RedirectToAction(nameof(ManageController.Index), "Manage");
            //}

            if (!ModelState.IsValid)
            {
                throw new BadRequestException(ModelState);
            }

            // Get the information about the user from the external login provider
            var info = await _signInManager.GetExternalLoginInfoAsync();

            if (info == null)
            {
                throw new NeedLoginException();
            }

            var matches = await _members.ByEmail(model.Email);

            var pending = _userManager.FindPendingUserEmail(model.Email);

            if (
                matches.Count != 1 &&
                (pending == null || string.IsNullOrWhiteSpace(pending.InvitationCode) || string.IsNullOrWhiteSpace(model.Invite)))
            {
                return("NeedInvite");
            }

            if (pending == null)
            {
                pending = new PendingUser {
                    Email = model.Email
                };
            }

            var token = Guid.NewGuid().ToString().Replace("-", "");

            pending.VerifyCode = token;
            _userManager.UpdatePending(pending);
            await _emailSender.SendEmailAsync(model.Email, "Email Verification Code",
                                              $"Your verification code is <b>{token}</b>");

            return("OK");
        }