Save object to shared database

Maybe I'm going about this completely the wrong way but I've got two stores loaded in my app: private and shared. I've got zone-wide sharing enabled and I can update records that exist in the shared database (on the participant device), and see updates sync when changed by the owner.

However, is it possible to save a new object specifically to the shared database as the participant? If I create a new object in my managed object context it saves it to the private database.

Can provide code if needed but it's more conceptual at this stage.

Replies

Solved it whilst this post was being reviewed. If anyone else comes across this problem it's pretty straight forward:

// Just an example
let newObject = Item(context: self.context)
let sharedStore : NSPersistentStore = CoreDataStack.shared.sharedStore

self.context.assign(newObject, to: sharedStore)

// save etc.