public function getRegistry(string $registryName, $entityClass = null, EntityManager $entityManager = null)
    {
        if (!array_key_exists($registryName, self::$registries)) {
            throw new InvalidRegistryName($registryName);
        }

        $reflectionClass = new \ReflectionClass(self::$registries[$registryName]);

        /** @var RegistryInterface $instance */
        $instance = $reflectionClass->newInstance();

        $this->injectDependencies($instance, $entityClass, $entityManager);

        return $instance;
    }