public void WriteRules(IDestinationFolder targetFolder, Action <List <BadMessageRec> > reportBadItemsDelegate) { if (this.FolderType == FolderType.Search) { return; } CommonUtils.ProcessKnownExceptions(delegate { targetFolder.SetRules(this.Rules); }, delegate(Exception ex) { if (reportBadItemsDelegate != null && CommonUtils.ExceptionIsAny(ex, new WellKnownException[] { WellKnownException.DataProviderPermanent, WellKnownException.MapiNotEnoughMemory })) { List <BadMessageRec> list = new List <BadMessageRec>(1); list.Add(BadMessageRec.Folder(this.FolderRec, BadItemKind.CorruptFolderRule, ex)); reportBadItemsDelegate(list); return(true); } return(false); }); }