private function doRefresh($xmlEntity, array &$visited)
    {
        $oid = spl_object_hash($xmlEntity);
        if (isset($visited[$oid])) {
            return; // Prevent infinite recursion
        }

        $visited[$oid] = $xmlEntity; // mark visited

        $class = $this->xem->getClassMetadata(get_class($xmlEntity));
        if ($this->getXmlEntityState($xmlEntity) == self::STATE_MANAGED) {
            // @todo refresh xml-entity
        } else {
            throw new \InvalidArgumentException("XmlEntity is not MANAGED.");
        }
    }