private function createRepositoryReferenceServiceReference(
        ContainerBuilder $container,
        string $appName,
        array $repositoryConfiguration,
        string $indexId,
        string $indexName
    ): Definition {
        $repositoryReferenceName = rtrim("apisearch.repository_reference.$appName.$indexName", '.');
        $appUUIDReference = $container->register("apisearch.app_uuid.$appName", AppUUID::class);
        $appUUIDReference
            ->setFactory([
                AppUUID::class,
                'createById',
            ])
            ->addArgument((string) $repositoryConfiguration['app_id'])
            ->setPrivate(true);

        $indexUUIDReference = $container->register("apisearch.index_uuid.$appName.$indexName", IndexUUID::class);
        $indexUUIDReference
            ->setFactory([
                IndexUUID::class,
                'createById',
            ])
            ->addArgument((string) $indexId)
            ->setPrivate(true);

        $reference = $container->register($repositoryReferenceName, RepositoryReference::class);
        $reference
            ->setFactory([
                RepositoryReference::class,
                'create',
            ])
            ->addArgument(new Reference("apisearch.app_uuid.$appName"))
            ->addArgument(new Reference("apisearch.index_uuid.$appName.$indexName"))
            ->setPublic($this->repositoryIsTest($repositoryConfiguration));

        return $reference;
    }