C# forming nested List of child objects from parent object : <p>I have got a class structure like below,</p>

<pre><code>class Employees
{
public string Id {get;set;}
public string BossId {get;set;}
public List&lt;Employees&gt; Subordinates {get;set;}
}
</code></pre>

<p>Currently I have got a List with 4 records.</p>

<pre><code>1. Id = 1, BossId = null
2. Id = 2, BossId = 1
3. Id = 3, BossId = 2
4. Id = 4, BossId = null
</code></pre>

<p>Now I need to form a List object as below by populating the Subordinates property.</p>

<pre><code>Employees 
{
Id: 1
Subordinates : 
 { 
   Employees :
   {
     Id : 2
     Subordinates :
     {
       Employees:
       {
         Id: 3
         Subordinates : null
       }
     }
   }
 }
},
Id: 2
Subordinates: null
}
</code></pre>

<p>Please help</p>
