parent_id - recursion - get all dependent categories
<p>In my database each category record has got column CategoryId and CategoryParentId. How can I get List with id all children categories for current category and children its children etc? I have that code:</p>

<pre><code>public void AllDependentCategories(int categoryId)
{
        IQueryable&lt;Category&gt; categoriesList = Context.CategoryRepository
          .FindAll()
          .Where(x =&gt; x.CategoryParentId == categoryId);

        foreach (var category in categoryList)
        {
          AllDependentCategories(category.CategoryId);
        }
}
</code></pre>
