Building a tree out of items list
<p>I would like to get some suggestions on how I can build a tree out of items list in a efficient way</p>

<pre><code> public class Item
    {
        public Item(int id, int? parentId)
        {
            Id = id;
            ParentId = parentId;
        }

        public int Id { get; private set; }
        public int? ParentId { get; private set; }
        public List&lt;Item&gt; SubItems  { get; set; }
    }

    private Item BuildATree()
    {
        var items = new List&lt;Item&gt;()
                        {
                            new Item(1, null),
                            new Item(2, 1),
                            new Item(3, 1),
                            new Item(4, 1),
                            new Item(5, 2),
                            new Item(6, 2),
                            new Item(7, 4),
                            new Item(8, 7),
                            new Item(9, 1),
                        };

        //Build a tree out of list items
    }
</code></pre>

<p>The result I am expecting is each item being in its parent's SubItems list</p>

<p>Not necessarily using the same Item class, because Ids would be redundant then</p>
