public function attachRegistryToRepository(ContainerBuilder $container, $registryId, $repositoryId)
    {
        $registry   = $container->getDefinition($registryId);
        $repository = $container->getDefinition($repositoryId);
        if ( ! $registry->hasTag('spray_persistence.filter_registry')) {
            $registry->addTag('spray_persistence.filter_registry');
        }
        if ( ! $repository->hasMethodCall('setFilterLocator')) {
            $repository->addMethodCall('setFilterLocator', array(
                new Reference($registryId)
            ));
        }
    }