Promise.resolve().then(() => {
            if (typeof restoreState === `function`) {
                return restoreState(localInstance, message.data);
            }
        }).then(() => {