     }
     
     private init(pathToRealmToBeSynced: String, encryptionKey: NSData?, pathToCloudKitRealm: String, options: Options) {
-        self.backgroundRealm = MultiRealm(path: pathToRealmToBeSynced, readOnly: false, encryptionKey: encryptionKey, queueType: .Background)
+      //        self.backgroundRealm = MultiRealm(path: pathToRealmToBeSynced, readOnly: false, encryptionKey: encryptionKey, queueType: .Background)
+        self.backgroundRealm = MultiRealm(.Background, {})
+        self.backgroundRealm.set(try! Realm(path: pathToRealmToBeSynced))
         self.options = options
         self.path = pathToCloudKitRealm
         

import Security
import Internet
import ReachabilitySwift


internal let domain = "com.bellapplab.RealmCloudKit"
internal let bundle = NSBundle(identifier: "org.cocoapods.RealmCloudKit")!

        }
        
        let keychain = Keychain(service: domain).accessibility(.WhenUnlockedThisDeviceOnly)
        var password = try! keychain.getData("RealmCloudKit")
        if password == nil {
            // Generate a random encryption key
            let key = NSMutableData(length: 64)!
            SecRandomCopyBytes(kSecRandomDefault, key.length,
                UnsafeMutablePointer<UInt8>(key.mutableBytes))
            try! keychain.set(key, key: "RealmCloudKit")
            password = key
        }
//        self.cloudKitRealm = MultiRealm(path: self.path, readOnly: false, encryptionKey: password!, queueType: .Background)
        self.cloudKitRealm = MultiRealm(.Background, {})
        self.cloudKitRealm.set(try! Realm(path: self.path))
      
        self.setupInternetChange()
    }
    
