private function validateTheme(string $theme)
    {
        if (!file_exists($this->themePath . '/' . $theme . '/info.json')) {
            throw new InvalidException('The theme (`' . $theme . '`) is missing the configuration file (`info.json`).');
        }

        try {
            $themeInfo = $this->getThemeInfo($theme);
        } catch (\Throwable $e) {
            throw new InvalidException('The theme\'s (`' . $theme . '`) configuration file (`info.json`) does not contain valid json or could not be read.');
        }

        foreach (self::CONFIG_REQUIRED_FIELDS as $requiredField) {
            if (!array_key_exists($requiredField, $themeInfo)) {
                throw new InvalidException('The theme\'s (`' . $theme . '`) configuration file (`info.json`) is missing the required theme ' . $requiredField . ' property.');
            }
        }
    }