protected function inTree(NodeInterface $node1, NodeInterface $node2)
    {
        if($node1 == $node2) {
            return true;
        } elseif(!is_null($parent = $node1->getParent())) {
            return $this->inTree($parent, $node2);
        }

        return false;
    }