public async Task Execute(Input input) { Guid CustomerId; var result = CommonAccess.GetAccessCustomer(input.CustomerId, _accountRepository, _loginUserService).Result.ToString(); if (!Guid.TryParse(result, out CustomerId)) { _outputHandler.Error(result); return; } ICustomer customer = await registerUserService.GetCustomer(CustomerId); if (customer == null) { _outputHandler.Error($"The customer {CustomerId} does not exists or is not processed yet."); return; } List <Boundaries.GetCustomerDetails.Account> accounts = new List <Boundaries.GetCustomerDetails.Account>(); foreach (Guid accountId in customer.Accounts) { IAccount account = await _accountRepository.Get(accountId); if (account != null) { Boundaries.GetCustomerDetails.Account accountOutput = new Boundaries.GetCustomerDetails.Account(account); accounts.Add(accountOutput); } } Output output = new Output(customer, accounts); _outputHandler.Handle(output); }