save trees in sql