class MyTreeNode
{
public String NodeTitle;
public List<MyTreeNode> children;
}
I would build my desired structure into an object then recursively search through the children property to see if I needed to add more branches.
public AddBranch(MyTreeNode parentNode)
{
MyTree.Add(parentNode.NodeTitle);
foreach (var node in parentNode.children)
{
AddBranch(node);
}
}
// Note this is a rough mock code just to give you an idea of what recursion is.