public function set(string $key, string $value) : self
    {
        if (!$setting = $this->get($key)) {
            $setting = new self($this->getSettingsKey());
        }

        $setting->key = $key;
        $setting->value = $value;

        if (!$setting->save()) {
            throw new Exception(current($setting->getMessages()));
        }

        return $setting;
    }