static save(state) {
    const result = {};
    const flatten = (cur, prop) => {
      if (Object(cur) !== cur) {
        result[prop] = cur;
      } else {
        let isEmpty = true;
        for (const p in cur) {
          if (Object.prototype.hasOwnProperty.call(cur, p)) {
            isEmpty = false;
            flatten(cur[p], prop ? prop + '.' + p : p);
          }
        }
        if (isEmpty && prop != '') {
          result[prop] = {};
        }
      }
    };
    flatten(state, '');
    return Object.keys(result)
      .map((k) => `${k}=${result[k]}`)
      .join('&');
  }
Serialize the state into a hash string.
@param {Object} state The state.
@returns {string} The serialized state.