Fix parent_id not getting dirty after assignment before hitting save Implement tree restoring algorithm