This shouldnt be so hard. All you need to do is store all the people in the database that could look something like this:
UniquePersonID PersonNAme Level Parent
1 David Weatherbeam 0 Nothing/Null
2 Alberto Weatherbeam 1 1
Now you could easely retrive all the data you need to make the connections.
So good luck to you