Save nodes to db