node id parent node id ------- -------------- 100 null //this is the root node 101 100 123 101 124 101 126 101 103 100 104 100 109 100 128 109 122 100 127 122 129 127 130 129 AddChildNodes(TreeNode parentNode) { var childNodeIds GetChildNodeIds(parentNode.Id); foreach (int childNodeId in childNodeIds) { TreeNode childNode = new TreeNode(); //set other properties... //add to parent parentNode.Nodes.Add(childNode); //call same function recursively AddChildNodes(childNode); }