public void ReturnSuccessorsTree()
 {
     if (SelectedPerson == null)
     {
         MessageBox.Show("Nie wybrano osoby", "Błąd", MessageBoxButton.OK, MessageBoxImage.Error);
         return;
     }
     else
     {
         SuccessorsTreeItem root = SuccessorsTreeHelper.GetPersonsChildren(SelectedPerson.Name);
         SuccessorsTreeItem rootWithFirstPerson = new SuccessorsTreeItem {
             Title = "root"
         };
         rootWithFirstPerson.Items.Add(root);
         SelectedPersonSuccessors = rootWithFirstPerson;
         NotifyOfPropertyChange(() => SelectedPersonSuccessors);
     }
 }
        public static SuccessorsTreeItem GetPersonsChildren(string personName)
        {
            SuccessorsTreeItem root = new SuccessorsTreeItem {
                Title = personName
            };
            IObjectContainer db = Db4oFactory.OpenFile("person.data");
            var person          = db.QueryByExample(new PersonModel(personName)).Next() as PersonModel;

            db.Close();
            if (person.Children != null)
            {
                foreach (var child in person.Children)
                {
                    db = Db4oFactory.OpenFile("person.data");
                    var personChild = db.QueryByExample(new PersonModel(child)).Next() as PersonModel;
                    db.Close();
                    root.Items.Add(GetPersonsChildren(personChild.Name));
                }
            }
            return(root);
        }