public async Task <Unit> Handle(ChangePasswordCommand request, CancellationToken cancellationToken) { if (!await _passwordManager.IsPasswordValid(request.UserId, request.OldPassword)) { throw new UnauthorizedException("Unauthorized", $"User with id: {request.UserId} has been unauthorized"); } if (!await _passwordManager.UpdatePassword(request.UserId, request.OldPassword, request.OldPassword)) { throw new UnauthorizedException("Unauthorized", $"User with id: {request.UserId} has been unauthorized"); } return(Unit.Value); }