public async Task <CommandResult> Handle(CreateAccountCommand request, CancellationToken cancellationToken) { CommandResult commandResult = new CommandResult(); commandResult.Errors = new List <string>(); if (request.ConfirmPassword != request.Password) { commandResult = new CommandResult { Successed = false, Errors = new List <string>() { "Password must match" } }; } var user = new ApplicationUser { Email = request.Email, UserName = request.Email }; var result = await _authenticationRepository.CreateAccount(user, request.Password); await _uow.Save(); if (result.Succeeded == false) { commandResult.Errors.AddRange(result.Errors.Select(x => x.Description)); } return(commandResult); }