protected function isParentOrRoot($value): bool
    {
        $id = spl_object_hash($value);
        $root = $this->root ? $this->root->getWrappedEntity()->getObject() : null;
        $parent = $this->parent ? $this->parent->getWrappedEntity()->getObject() : null;

        if ($parent && (spl_object_hash($parent) == $id)) {
            return true;
        }

        if ($root && (spl_object_hash($root) == $id)) {
            return true;
        }

        return false;
    }