public static function getRepository($identifier, $config = array())
    {
        if (strpos($identifier, 'repos:') === 0) {
            $repository = AnService::get($identifier);
        } else {
            $strIdentifier = (string) $identifier;

            if (!AnService::has($identifier)) {
                $identifier = self::getEntityIdentifier($identifier);
            }

            if (!AnService::has($identifier)) {
                AnService::set($strIdentifier, AnService::get($identifier, $config));
            }

            $repository = AnService::get($identifier)->getRepository();
        }

        return $repository;
    }