     
     private lazy var objectModel: NSManagedObjectModel = {
         let modelURL = self.bundle.url(forResource: self.modelName, withExtension: "momd")!
-        return makeOptional(NSManagedObjectModel(contentsOf: modelURL))!
+        return NSManagedObjectModel(contentsOf: modelURL)!
     }()
     
     override func newBackgroundContext() -> NSManagedObjectContext {
+        if sharedBackgroundContext {
+            return sharedWorkerContext
+        }
+        
+        return createBackgroundContext()
+    }
+    
+    private func createBackgroundContext() -> NSManagedObjectContext {
         let managedContext = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
         managedContext.parent = managedObjectContext
         managedContext.mergePolicy = NSMergePolicy(merge: mergePolicy)
         return managedContext
     }
 }
-
-//TODO jaanus: remove this. Issue in Xcode9 b5
-private func makeOptional<T>(_ value: T?) -> T? {
-    return value
-}
-

    private let directory: FileManager.SearchPathDirectory
    fileprivate let mergePolicy: NSMergePolicyType
    fileprivate let wipeOnConflict: Bool
    fileprivate var managedObjectModel: NSManagedObjectModel?
    fileprivate var persistentStoreCoordinator: NSPersistentStoreCoordinator {
        fatalError()

        self.directory = directory
        self.mergePolicy = mergePolicy
        self.wipeOnConflict = wipeOnConflict
        self.sharedBackgroundContext = sharedBackgroundContext
    }
    
    fileprivate var databaseFilePath: URL? {
