public void When(AddSecurityPassword c) { var user = new UserId(_identityGenerator.GetId()); var salt = _generator.CreateSalt(); var token = _generator.CreateToken(); var hash = _generator.HashPassword(c.Password, salt); Apply(new SecurityPasswordAdded(c.Id, user, c.DisplayName, c.Login, hash, salt, token)); }