private void EditSelectedBlockedAttachment() { if (listBlockedAttachments.SelectedItems.Count < 0) return; int id = Convert.ToInt32(listBlockedAttachments.SelectedItems[0].Tag); hMailServer.Settings settings = APICreator.Settings; hMailServer.AntiVirus antiVirusSettings = settings.AntiVirus; hMailServer.BlockedAttachments attachments = antiVirusSettings.BlockedAttachments; hMailServer.BlockedAttachment ba = attachments.get_ItemByDBID(id); formBlockedAttachment blockedDlg = new formBlockedAttachment(); blockedDlg.LoadProperties(ba); if (blockedDlg.ShowDialog() == DialogResult.OK) { blockedDlg.SaveProperties(ba); ba.Save(); } Marshal.ReleaseComObject(settings); Marshal.ReleaseComObject(antiVirusSettings); Marshal.ReleaseComObject(attachments); Marshal.ReleaseComObject(ba); ListBlockedAttachments(); }