protected function findNodeIndex(Node $node)
    {

        foreach ($this->data as $i=>$added) {
            if ($added->getId() == $node->getId()) {
                return $i;
            }
        }

        // Not found? try it by spl_object_hash
        $nodeHash = spl_object_hash($node);

        foreach ($this->data as $i=>$added) {
            if (spl_object_hash($added) == $nodeHash) {
                return $i;
            }
        }

        return null;

    }