         }
         set {
             guard let newValue = newValue else {
-                defaults.setNilValueForKey(#function)
+                defaults.removeObject(forKey: #function)
                 return
             }
 

    }

    private func performRealmOperations(with block: @escaping (Realm) -> Void) {
        let config = storage.realm.configuration

        workQueue.async { [weak self] in
            guard let self = self else { return }

            do {
                let queueRealm = try Realm(configuration: config)

                queueRealm.beginWrite()

                block(queueRealm)

                try queueRealm.commitWrite()
            } catch {
                os_log("Failed to perform Realm transaction: %{public}@", log: self.log, type: .error, String(describing: error))
            }
        }
    }


                       type: .error,
                       String(describing: error))

                if (error as? CKError)?.code == CKError.Code.changeTokenExpired {
                    os_log("Change token expired, clearing token and retrying", log: self.log, type: .error)

                    DispatchQueue.main.async {
                        self.privateChangeToken = nil
                        self.fetchChanges()
                    }
                } else {
                    error.retryCloudKitOperationIfPossible(self.log) { self.fetchChanges() }
                }
            } else {
                self.privateChangeToken = token
            }
