public function makeChildOf(NodeInterface $node, NodeInterface $newParent)
 {
     // Collect some informations before the node is changed to correct
     // the nodes in its old position
     $nodeWasNew = !$node->exists;
     $oldParentId = $node->__get($this->parentCol());
     $oldPosition = $node->__get($this->sortCol());
     // Set the position of this node. Default is last position in new Parent
     $node->__set($this->sortCol(), $this->getLastChildPosition($node, $newParent));
     parent::makeChildOf($node, $newParent);
     // If the node existed correct the positions of the old parent
     if (!$nodeWasNew && $oldParentId) {
         $this->decrementOrderAfter($oldParentId, $oldPosition);
     }
     return $this;
 }
 public function makeChildOf(Node $node, Node $newParent)
 {
     // The node is already a child of newParent
     if ($node->__get($this->parentCol()) == $newParent->__get($this->pkCol()) && $node->exists) {
         return $this;
     }
     $node->__set($this->parentCol(), $newParent->__get($this->pkCol()));
     $node->__set($this->rootCol(), $newParent->__get($this->rootCol()));
     $node->setParentNode($newParent);
     $newParent->addChildNode($node);
     $node->save();
     return $this;
 }