private static void FetchCategoriesRecursively(bool recursing, List<CachedCategory> list, CategoriesDB db, int categoryId, string levelPrefix)
{
CategoriesDataComponent.CategoriesDataTable subCategories = db.GetCategoriesByParentId(categoryId);
if (subCategories != null)
{
string categoryIdString = categoryId.ToString();
foreach (CategoriesDataComponent.CategoriesRow category in subCategories)
{
list.Add(new CachedCategory(category.Name, category.Id, categoryId, category.NumActiveAds, levelPrefix));
if (recursing)
FetchCategoriesRecursively(recursing, list, db, category.Id, levelPrefix + "--");
}
}
}