protected function updateDescendants(Tree $node, $oldDescendants)
    {
        $refs                  = [];
        $refs[$node->getKey()] = &$node; // Updated node
        foreach ($oldDescendants as &$child) {
            $refs[$child->getKey()] = $child;
            $parent_id              = $child->{$this->getTreeColumn('parent')};
            if (!empty($refs[$parent_id])) {
                if ($refs[$parent_id]->path != $refs[$child->getKey()]->removeLastNodeFromPath()) {
                    $refs[$child->getKey()]->level = $refs[$parent_id]->level + 1; // New level
                    $refs[$child->getKey()]->path  = $refs[$parent_id]->path . $child->getKey() . '/'; // New path
                    DB::table($this->getTable())
                        ->where($child->getKeyName(), '=', $child->getKey())
                        ->update(
                            [
                                $this->getTreeColumn('level') => $refs[$child->getKey()]->level,
                                $this->getTreeColumn('path')  => $refs[$child->getKey()]->path
                            ]
                        );
                }
            }
        }
        $this->fireModelEvent('updatedDescendants', false);
    }