public ProductView[] GetProducts() { List <ProductView> products = new List <ProductView>(); var catalog = catalogApi.Get(); if (catalog == null) { return(products.ToArray()); } foreach (string id in catalog.ProductList) { var product = productApi.Get(id); if (product != null) { products.Add(productConverter.Convert(product)); } } return(products.ToArray()); }