public function buildLocalFilterRegistries(ContainerBuilder $container)
    {
        $filters = $container->findTaggedServiceIds('spray_persistence.entity_filter');
        foreach ($filters as $filterId => $filterOptions) {
            foreach (array_filter($filterOptions, array($this, 'filterLocalFilterOptions')) as $options) {
                $registryId = $this->determineRegistryIdForRepositoryId($options['repository']);
                $this->attachFilterToRegistry(
                    $this->locateFilterRegistry($container, $registryId),
                    $filterId,
                    $options
                );
                $this->attachRegistryToRepository($container, $registryId, $options['repository']);
            }
        }
    }