Add method to parse nodes data into a tree structure