public void CreateBackup(IComponent component) { ValidateComponent(component); var backupPath = GetBackupPath(component); ValidateHasAccess(backupPath); if (_backupLookup.ContainsKey(component)) { return; } string?backupFilePath; var componentFilePath = component.GetFilePath(); if (File.Exists(componentFilePath)) { backupFilePath = CreateBackupFilePath(component, backupPath); FileSystemExtensions.CopyFileWithRetry(componentFilePath, backupFilePath); } else { backupFilePath = null; } lock (_syncObject) _backupLookup.Add(component, backupFilePath); }