The general form of a recursive function for a tree with a fixed number of children below the parent is like this:
sub ProcessTree(TreeToProcess as TreeTypeYouInvented)
ProcessParent()
if TreeToProcess.HasChildren then
ProcessTree(TreeToProcess.ChildNode1)
...
ProcessTree(TreeToProcess.ChldNodeN)
end if
end sub