public CommandResponse Handle(BlockAccount command) { if (!_repository.TryGetById <AccountAggregate.BankAccount>(command.AccountId, out var account)) { throw new InvalidOperationException("No account with such ID"); } account.Block(new Blocked(command.AccountId)); _repository.Save(account); return(command.Succeed()); }