public IEnumerable <ProductDto> Invoke(BusinessKeyDto input) { _logger.Log($"Starting {GetType().FullName}"); _logger.Log("Input model received: ", input, LogType.Debug); var businessKey = BusinessMapper.ToBusinessKey(input); var business = _businessRepository.Find(businessKey); if (business == null) { var error = new BusinessDoesNotExists(businessKey); _logger.Log(error.Message, businessKey, LogType.Error); throw error; } var products = _productRepository.FindByBusiness(businessKey); var output = new List <ProductDto>(products.Select(product => new ProductDto() { BusinessCode = business.Code, ProductCode = product.Code, ProductName = product.Name, ProductDescription = product.Description })); _logger.Log("Output model to return: ", output, LogType.Debug); return(output); }