async function saveSettings(settings) {
    let settingsToSave = helpers.deepCopy(settings);

    // 'default' is our reserved name for the default store
    delete settingsToSave.stores.default;

    // verify that the native host is happy with the provided settings
    var response = await hostAction(settingsToSave, "configure");
    if (response.status != "ok") {
        throw new Error(`${response.params.message}: ${response.params.error}`);
    }

    // before save, make sure to remove store settings that we receive from the host app
    if (typeof settingsToSave.stores === "object") {
        for (var store in settingsToSave.stores) {
            delete settingsToSave.stores[store].settings;
        }
    }

    for (var key in defaultSettings) {
        if (settingsToSave.hasOwnProperty(key)) {
            const save = {};
            save[key] = settingsToSave[key];
            await chrome.storage.local.set(save);
        }
    }

    // refresh in case user has just toggled showing badge counter
    updateMatchingPasswordsCount(settings.tab.id, true);
}
Save settings if they are valid

@since 3.0.0

@param object Final settings object
@return void