 		if let folder = note.object as? Folder, let folderAccount = folder.account, folderAccount === self {
 			dirty = true
 		}
+	}
+
+	@objc func saveToDiskIfNeeded() {
+
+		guard dirty else {
+			return
+		}
+		saveToDisk()
+		dirty = false
 	}
 
 	// MARK: - Equatable

				}
				else {
					NotificationCenter.default.post(name: .AccountRefreshDidFinish, object: self)
					if dirty {
						resetSaveTimer()
					}
				}
			}
		}

	let database: Database
	let delegate: AccountDelegate
	var username: String?
	static let saveQueue = CoalescingQueue(name: "Account Save Queue", interval: 1.0)

	public var dirty = false {
		didSet {
			if dirty {
				Account.saveQueue.add(self, #selector(saveToDiskIfNeeded))
			}
		}
	}
