public function preDelete(Event $event, Query $query, $id) {
        if (!$this->getConfig('onDelete')) {
            return true;
        }

        if ($node = $this->getNode($id)) {
            $count = $this->getRepository()->select()
                ->where($this->getConfig('parentField'), $id)
                ->count();

            if ($count) {
                return false;
            }

            $this->_deleteIndex = $node[$this->getConfig('leftField')];
        }

        return true;
    }