I know the title is not very clear but here is the problem. I am trying to develop simple web page with asp.net mvc and I have category controller and try to explain situation at the below code block.

```
    //
    // GET: /Category/
    public ViewResult Index(int? id)
    {

        if (id == null)
        {
            //Gives the following error if nut null, 1,2 etc
            //Unable to cast the type 'System.Nullable`1' to type 'System.Object'. 
            //LINQ to Entities only supports casting Entity Data Model primitive types.
            var categories = db.Categories.Where( c => Int32.Equals(c.ParentCategoryId, id));
            return View(categories);
        }
        else
        {
            //Does not show any category, must show item if ParentCategoryId is null
            var categories = db.Categories.Where(c => c.ParentCategoryId == id);
            return View(categories);
        }
    }

```

My data is 

```
ID    Name            ParentId
----------------------------------
1   Computer    NULL
2   TV          NULL
3   Laptop          1
4   Desktop         1

```