 		if var copy = self.copy() as? Self {
 			copy.version = version + 1
 			let old = Self.unarchiveDirty()
+			Self.cached.set(value: self.copy() as? Self, forKey: Self.dirtyPath)
 			copy.archive(at: Self.dirtyPath)
 			handleDirtyChanges(old: old, new: self)
 		}

		Self.resetCurrent()
	}
	static func resetDirty() {
		Self.remove(at: Self.dirtyPath)
	}
	static func unarchiveDirty() -> Self {
		return Self.unarchive(from: Self.dirtyPath) ?? Self.unarchiveCurrent()
	}
	static func modifyAll(with block: (Self) -> Void) {
		let du = Self.unarchiveDirty()
		block(du)
		du.archiveDirty()

		let cu = Self.unarchiveCurrent()
		block(cu)
		cu.archiveCurrent()
	}
}

	func removeSensitiveData()
	static func resetCurrent()
	static func unarchiveCurrent() -> Self
	static func removeArchive(at path: String)
	func handleCurrentChanges(old: Self, new: Self)
	static func modifyCurrent(with block: (Self) -> Void)
}

extension ArchivableCurrent where Self: NSCopying {
	func archiveCurrent() {
		let old = Self.unarchiveCurrent()
		Self.cached.set(value: self.copy() as? Self, forKey: Self.currentPath)
		archive(at: Self.currentPath)
		handleCurrentChanges(old: old, new: self)
	}
	func archive(at path: String) {
		MMLogDebug("Archiving \(self) at \(path)")
		let save = self.copy() as! Self
		save.removeSensitiveData()
		NSKeyedArchiver.archiveRootObject(save, toFile: path)
	}
	static func resetCurrent() {
		Self.cached.set(value: nil, forKey: Self.currentPath)
		Self.removeArchive(at: Self.currentPath)
	}
	static func unarchiveCurrent() -> Self {
		if let cached = Self.cached.getValue(forKey: Self.currentPath), let ret = cached.copy() as? Self {
			return ret
		} else {
			let current = Self.unarchive(from: Self.currentPath) ?? Self.empty
			Self.cached.set(value: current.copy() as? Self, forKey: Self.currentPath)
			return current
		}
	}
	static func unarchive(from path: String) -> Self? {
		let unarchived = NSKeyedUnarchiver.unarchiveObject(withFile: path) as? Self
		MMLogDebug("Unarchived \(String(describing: unarchived)) from \(path)")
		return unarchived
	}
	static func removeArchive(at path: String) {
		MMLogDebug("Removing archive at \(path)")
		do {
			try FileManager.default.removeItem(atPath: path)
		} catch {
			MMLogDebug("Unexpected error while removing archive at \(path): \(error)")
		}
	}
	static func modifyCurrent(with block: (Self) -> Void) {
		let o = Self.unarchiveCurrent()
		block(o)
		o.archiveCurrent()
	}
}

