public async Task Execute(Input input) { if (input == null) { _outputHandler.Error("Input is null."); return; } var registerOutput = _registerUserService.Execute(input.Name.ToString(), input.Password.ToString()); if (registerOutput == null) { _outputHandler.Error("An error throw when registering user ID"); return; } var customer = _entityFactory.NewCustomer(registerOutput.CustomerId, input.SSN, input.Name); var account = _entityFactory.NewAccount(customer.Id); ICredit credit = account.Deposit(input.InitialAmount); if (credit == null) { _outputHandler.Error("An error happened when depositing the amount."); return; } customer.Register(account.Id); await _customerRepository.Add(customer); await _accountRepository.Add(account, credit); Output output = new Output(customer, account, registerOutput.Token); _outputHandler.Handle(output); }