I will give you two advices:
1) Your code is generating tree in vertical format which is visually not very good. As a multi level marketing user's perspective, I want to see who is the member in my branch(horizontally) and so on.
2) You are iterating the whole set of result and adding the found member as a child node for treeview. This will make your program very slow.
Now the solution:
1) Use repeater control and play with some css to create a horizontal display starting from root member to child members.
2) Go through
This[
^] example. This will give you generation as last column. This last column is the key to create your horizontal tree.
Best of luck.