public function add(ThemeSettings $settings, string $key = null) : ?Theme
    {
        if ($key !== null) {
            $settings->key = $key;
        }

        if ($this->has($settings->key)) {
            throw new KeyExistsException("Theme with key '{$settings->key}' already exists");
        }

        if ($settings->enabled) {
            $theme = new Theme($settings);

            if ($settings->default === true && $this->default === null) {
                $this->setDefault($theme);
            }

            if ($settings->override === true && $this->override === null) {
                $this->setOverride($theme);
            }

            $this->themes[$settings->key] = $theme;
        }

        return $theme ?? null;
    }