applyUpdate(updateSpec) {
        const tx = this._getTransaction(updateSpec);
        const result = this.db.update(updateSpec, tx, this.state);
        const { status, state, payload } = result;

        if (status !== SUCCESS) {
            throw new Error(
                `Applying update failed with status ${status}. Payload: ${payload}`
            );
        }

        this.state = state;

        return payload;
    }
Applies update to a model state.

@private
@param {Object} update - the update object. Must have keys
                         `type`, `payload`.