public async Task <JsonResult> SendUpVerificationCode(ContactDetailViewModel model) { //Check if any user exist that already used the phone number. var signUpUser = await _userManager.FindByPhoneNumberAsync(model.PhoneNumber); //Check if user supplied email address, if yes, check if a user exist that already used the email. if (!string.IsNullOrEmpty(model.Email)) { signUpUser = await _userManager.FindByEmailAsync(model.Email); } //If user exists with either phone number or email end verification sending. if (signUpUser != null) { throw new UserFriendlyException(L("UserAlreadyExist")); } await _verificationCodeService.GenerateAndSendVerificationCode(model.PhoneNumber); return(Json(new { })); }