public List <string> GetSubCategoryNames(int categoryIndex) { Category catSelected = (Category)_categories.ElementAt(categoryIndex); _subCategories = _repository.GetSubCategories(catSelected.Id); List <string> subCatNames = new List <string>(); foreach (SubCategory subCat in _subCategories) { subCatNames.Add(subCat.Name); } return(subCatNames); }