Tree structure to get parent node and its children
===

Please find the table  structure below:

Folderid                    parentFolderid              Guid
--
1  -----------------------                               0 ----------------------------                       1234
     
2-------------------------                    1 ----------------------------                       5678

3       -----------------------             2 -----------------------------                        9012

4------------------------                        3----------------------------87697

5------------------------                     7-----------------------------                           4443 

The requirement is if I pass folderId the function has to give me all the guids.

For example:If i pass 1 to the function I should get first four Guids(parent and its children)
I have a function which returns all the guids as follows:

Public List<guid> Folders(int folderId)

{

//To get the folderids based on parentfolderid

 Var a =entity.where(x=>x.parentfolderId==folderid).firstOrDefault();


}

I am able to get only upto one level of ids.

Is there any way to get parent and its children .?


