I have a Category table and it has a Parent Category, I try to iterate over all the categories and get the parents categories with it's Inverse Parent but some of them returns without the inverse parents from unknown reason.

Categories.cs

```
 public partial class Categories
{
    public Categories()
    {
        InverseParent = new HashSet<Categories>();   
    }

    public int Id { get; set; }
    public int? ParentId { get; set; }
    public DateTime CreateDate { get; set; }
    public bool? Status { get; set; }

    public virtual Categories Parent { get; set; }

    public virtual ICollection<Categories> InverseParent { get; set; }

}

```

This is how I try to iterate them to create a select list items:

```
  var parentCategories = await _context.Categories.
                                                      Include(x => x.Parent).
                                                      Where(x => x.Status == true).
                                                      Where(x => x.Parent != null).
                                                      Select(x => x.Parent).
                                                      Distinct().
                                                      ToListAsync();

                foreach (var parent in parentCategories)
                {
                    SelectListGroup group = new SelectListGroup() { Name = parent.Id.ToString() };
                    foreach (var category in parent.InverseParent)
                    {
                        categories.Add(new SelectListItem { Text = category.Id.ToString(), Value = category.Id.ToString(), Group = group });
                    }
                }

```

So the problem is that some of my parent categories returns all their children categories and some don't and I don't why.