 
 		return mom
 	}
-}
-
+
+}
+
+
+
+
+fileprivate typealias Notifications = RTCoreDataStack
+fileprivate extension Notifications {
+
+	func setupNotifications() {
+
+		NotificationCenter.default.addObserver(self,
+		                                       selector: #selector(Notifications.handle(notification:)),
+		                                       name: .NSManagedObjectContextDidSave,
+		                                       object: nil)
+	}
+
+	@objc func handle(notification: Notification) {
+		if !shouldMergeIncomingSavedObjects { return }
+
+		let inserted = notification.userInfo?[NSInsertedObjectsKey] as? [NSManagedObject] ?? []
+		let deleted = notification.userInfo?[NSDeletedObjectsKey] as? [NSManagedObject] ?? []
+		let updated = notification.userInfo?[NSUpdatedObjectsKey] as? [NSManagedObject] ?? []
+		//	is there anything to do?
+		if inserted.count == 0 && deleted.count == 0 && updated.count == 0 { return }
+		//	only deal with notifications coming from MOC
+		guard let savedContext = notification.object as? NSManagedObjectContext else { return }
+
+		// ignore change notifications from the main MOC
+		if savedContext === mainContext { return }
+
+		// ignore change notifications from the direct child of the mainContext. this merges automatically when save is invoked
+		if let parentContext = savedContext.parent {
+			if parentContext === mainContext { return }
+		}
+
+		// ignore stuff from unknown PSCs
+		if let coordinator = savedContext.persistentStoreCoordinator {
+			if coordinator !== mainCoordinator && coordinator !== writerCoordinator { return }
+		}
+
+		mainContext.perform({ [unowned self] in
+			self.mainContext.mergeChanges(fromContextDidSave: notification)
+		})
+	}
+}
 
 
 fileprivate typealias Contexts = RTCoreDataStack

		}
	}

}



		moc.mergePolicy = (isMainContextReadOnly) ? NSRollbackMergePolicy : NSMergeByPropertyStoreTrumpMergePolicy

		mainContext = moc
	}

	var storeDescription: NSPersistentStoreDescription {
		let sd = NSPersistentStoreDescription(url: storeURL)
		//	use options that allow automatic model migrations
		sd.setOption(true as NSObject?, forKey: NSMigratePersistentStoresAutomaticallyOption)
		sd.shouldInferMappingModelAutomatically = true
		return sd
	}

	var defaultStoreURL: URL {
