public function register($file)
    {
        $theme = json_decode(file_get_contents($file), true);

        $validator = $this->getValidationFactory()->make($theme, [
            'name'        => 'required',
            'theme'       => 'required',
            'type'        => 'required',
            'version'     => 'required',
            'description' => 'required',
            'positions'   => 'required',
        ]);

        if ($validator->fails()) {
            throw new \Exception('Invalid theme configuration: ' . $file->getRealPath());
        }

        $this->themes[$theme['type'] . '.' . $theme['theme']] = new Theme(
            $theme['name'],
            $theme['theme'],
            $theme['type'],
            $theme['version'],
            $theme['description'],
            (array) $theme['positions'],
            $theme
        );
    }