public ResourceHandle[] AddResources(FileSystemInfo[] paths) { ArgumentUtility.CheckNotNull ("paths", paths); var handles = new List<ResourceHandle>(); try { handles.AddRange (paths.Select (AddResource)); return handles.ToArray(); } catch (InvalidOperationException) { foreach (var resourceHandle in handles) // roll back RemoveResource (resourceHandle); throw; } }