private void SaveAddressBook(string path, AddressBook addressbook) { if(File.Exists(path) && addressbook.IsDirty()) { //Only backup file if it isn't already a backup file! if(!Utilities.IsBackupFile(path)) { var bakFileName = Utilities.GetBackupFileName(path); File.Move(path, bakFileName); File.SetAttributes(bakFileName, File.GetAttributes(bakFileName) | FileAttributes.ReadOnly); } } ImportExport.SaveToXml(path, addressbook); SetFilePath(path); }