public CommandResponse Handle(DepositCash command) { try { if (!_repository.TryGetById <Account>(command.AccountId, out var account)) { throw new InvalidOperationException("Account not exisit"); } account.DepositCash(command.AccountId, command.Amount, _clock, command); _repository.Save(account); return(command.Succeed()); } catch (Exception e) { return(command.Fail(e)); } }