protected static function _cache($entity)
    {
        static $cache;

        if (!$cache) {
            $cache = new AnObjectArray();
        }

        if (!isset($cache[$entity->getRepository()])) {
            $cache[$entity->getRepository()] = new ArrayObject();
        }

        return $cache[$entity->getRepository()];
    }