Merge "[PM] Add doRestore check and write pendingRestore" into main