public async Task <ServiceResponseData> ConfirmEmailAndSetPasswordAsync(ConfirmEmailData model)
        {
            var responseData = new ServiceResponseData();

            try
            {
                if (!string.Equals(model.Password, model.ConfirmPassword))
                {
                    throw new Exception("Confirm password does't match");
                }
                var userEntity = _aspNetUserRepository.Get().SingleOrDefault(c => c.Id == model.UserId && c.SecurityToken == model.Token);
                if (userEntity == null)
                {
                    throw new Exception("Confirmation failed, invalid verification token!");
                }

                var user = await _userManager.FindByIdAsync(model.UserId.ToString());


                if (user.EmailConfirmed && await _userManager.HasPasswordAsync(user))
                {
                    throw new Exception("Your account has been confirmed already!");
                }

                var confirmationToken = await _userManager.GenerateEmailConfirmationTokenAsync(user);

                var confirmResult = await _userManager.ConfirmEmailAsync(user, confirmationToken);

                if (!confirmResult.Succeeded)
                {
                    throw new Exception(confirmResult.Errors.FirstOrDefault().Description);
                }


                var addPasswordResult = await _userManager.AddPasswordAsync(user, model.Password);

                if (!addPasswordResult.Succeeded)
                {
                    throw new Exception(addPasswordResult.Errors.FirstOrDefault().Description);
                }
                user.IsActive = true;
                await _userManager.UpdateAsync(user);
            }
            catch (Exception ex)
            {
                responseData.ErrorMessage = ex.ProcessException(_errorService);
                responseData.IsSuccess    = false;
            }

            return(await Task.FromResult(responseData));
        }