public static function getModelClass($name)
    {
        // If the name contains a backslash it is already fully qualified. However in some cases
        // a model might be replaced by a new class and so we must first look to see if this model is
        // mapped and if so return it's replacement instead.
        if (stripos($name, "\\") !== false) {
            $newName = self::getModelNameFromClass($name);

            if ($newName === null) {
                // $name hasn't been registered as a model object. Play safe and return the
                // same class name passed to us.
                return '\\' . ltrim($name, '\\');
            }

            $name = $newName;
        }

        if (self::$modelClassesCache == null) {
            self::$modelClassesCache = [];

            $schemas = self::getAllSchemas();

            self::$modelNamesCache = [];

            foreach ($schemas as $schema) {
                self::$modelClassesCache = array_merge(self::$modelClassesCache, $schema->models);
                self::$modelNamesCache = array_merge(self::$modelNamesCache, $schema->modelClassNames);
            }
        }

        if (isset(self::$modelClassesCache[$name])) {
            return '\\' . ltrim(self::$modelClassesCache[$name], '\\');
        }

        return null;
    }