How to extend NSPersistentCloudKitContainer to upgrade generated CKRecords

Hi, I am developing sharing feature with already working mirroring and need to set parentRecord to child items. I want to extend NSPersistentCloudKitContainer (or any it's component used for mirroring) in some way to get access to CKRecords it is creating before container will push records to the server.

Goal — I want to set CKRecord.parent right before CKModifyRecordsOperation fires somewhere in NSPersistentCloudKitContainer.

Reason — NSPersistentCloudKitContainer do not handle parent records by itself.
How to extend NSPersistentCloudKitContainer to upgrade generated CKRecords
 
 
Q