private void AddContactGroupSubscriber( string contactGroupName, string newsletterName, string siteName) { var contactGroupInfo = ContactGroupInfoProvider.GetContactGroupInfo(contactGroupName); if (contactGroupInfo == null) { return; } var siteInfo = SiteInfoProvider.GetSiteInfo(siteName); var newsletterInfo = NewsletterInfoProvider.GetNewsletterInfo(newsletterName, siteInfo.SiteID); if (newsletterInfo == null || SubscriberInfoProvider.GetSubscriberInfo("om.contactgroup", contactGroupInfo.ContactGroupID, siteInfo.SiteID) != null) { return; } var subscriber = new SubscriberInfo { SubscriberType = "om.contactgroup", SubscriberRelatedID = contactGroupInfo.ContactGroupID, SubscriberSiteID = siteInfo.SiteID, SubscriberFirstName = contactGroupInfo.ContactGroupDisplayName, SubscriberFullName = string.Format("Contact group '{0}'", contactGroupInfo.ContactGroupDisplayName) }; SubscriberInfoProvider.SetSubscriberInfo(subscriber); SubscriberNewsletterInfoProvider.AddSubscriberToNewsletter(subscriber.SubscriberID, newsletterInfo.NewsletterID, DateTime.Now, true); SubscriberNewsletterInfoProvider.AddSubscriberToNewsletter(subscriber.SubscriberID, newsletterInfo.NewsletterID, DateTime.Now, true); }