 import RxSwift
 import CloudKit
 
-typealias ZoneTokenMap = [CKRecordZoneID: CKServerChangeToken]
+typealias ZoneTokenMap = [Data: Data]
 
 public protocol CacheDelegate {
     func cache(record: CKRecord)

    // MARK:- token
    
    private func save(token: CKServerChangeToken, for key: String) {
        self.defaults.set(NSKeyedArchiver.archivedData(withRootObject: token), forKey: key)
    }
    
    private func token(for key: String) -> CKServerChangeToken? {
        
        if let object = self.defaults.object(forKey: key) as? NSData {
            return NSKeyedUnarchiver.unarchiveObject(with: object as Data) as? CKServerChangeToken
        }
        
        return nil
    }
}

            
            for recordZoneID in recordZoneIDs {
                
                if let token = tokenMap[self.key(zoneID: recordZoneID)] {
                    let options = CKFetchRecordZoneChangesOptions()
                    options.previousServerChangeToken = self.value(token: token)
                    optionsByRecordZoneID[recordZoneID] = options
                }
                
