public async Task RemoveEmployee(string companyName, int employeeId, CancellationToken token) { Logger.LogInformation("Remove employee ID '{EmployeeID}' for company: {Company}", employeeId, companyName); var company = await CompanyRepository.GetCompanyByName(companyName, token).ConfigureAwait(false); if (company == null) { // throw some kind of 'NotFound' exception to controller Logger.LogInformation("Company not found: {Company}", companyName); throw new Exception(); } var employee = await EmployeeRepository.GetEmployeeByEmployeeId(company.Id, employeeId, token).ConfigureAwait(false); if (employee == null) { // throw some kind of 'NotFound' exception to controller Logger.LogInformation("Company '{Company}' employee ID not found: {EmployeeID}", companyName, employeeId); throw new Exception(); } await EmployeeRepository.RemoveEmployee(employee.Id, token).ConfigureAwait(false); }