public function evaluateEntityNamespace(string $namespace)
    {
        /**
         * Trying to generate new entity given that the class is the entity
         * namespace.
         */
        if (class_exists($namespace)) {
            return $namespace;
        }

        /**
         * Trying to generate new entity given that the namespace is defined in
         * as a Container parameter.
         */
        $container = $this->container;
        if (
            $container->hasParameter($namespace) &&
            class_exists($container->getParameter($namespace))
        ) {
            $namespaceParameter = $container->getParameter($namespace);

            return $namespaceParameter;
        }

        $resolvedNamespace = explode(':', $namespace, 2);
        $bundles = $this->kernel->getBundles();

        /**
         * Trying to get entity using Doctrine short format.
         *
         * MyBundle:MyEntity
         *
         * To accept this format, entities must be at Entity/ folder in the
         * bundle root dir
         *
         * /MyBundle/Entity/MyEntity
         *
         * If entity definition is wrong, throw exception
         * If bundle not exists or is not actived, throw Exception
         */
        if (
        !(
            isset($resolvedNamespace[0]) &&
            isset($bundles[$resolvedNamespace[0]]) &&
            $bundles[$resolvedNamespace[0]] instanceof Bundle &&
            isset($resolvedNamespace[1])
        )
        ) {
            throw new ClassNotFoundException(
                $namespace,
                new ErrorException()
            );
        }

        /**
         * @var Bundle $bundle
         */
        $bundle = $bundles[$resolvedNamespace[0]];
        $bundleNamespace = $bundle->getNamespace();
        $namespace = $bundleNamespace . '\\Entity\\' . $resolvedNamespace[1];

        if (!class_exists($namespace)) {
            throw new ClassNotFoundException(
                $namespace,
                new ErrorException()
            );
        }

        /**
         * Otherwise, assume that class is namespace of class.
         */

        return $namespace;
    }