public async Task CreateAsync(Contact contact)
        {
            if(contact == null)
            {
                throw new ArgumentNullException("contact");
            }

            using (WSDataContext context = new WSDataContext())
            {
                if (HttpContext.Current != null && HttpContext.Current.Request != null)
                {
                    contact.IPAddress = HttpContext.Current.Request.UserHostAddress;
                }
                else
                {
                    contact.IPAddress = null;
                }

                Context.Contacts.Add(contact);
                var result = await Context.SaveChangesAsync();

                if (result > 0)
                {
                    NameValueCollection messageVars = new NameValueCollection();
                    messageVars.Add("%%NAME%%", contact.Name);

                    MailManager.SendEmail("ContactConfirmation", contact.Name, contact.EmailAddress, null, messageVars);

                    WSConfigurationSection config = WSConfigurationManager.GetSection();

                    if (config.ContactNotificationSubscribers != null && config.ContactNotificationSubscribers.Count > 0)
                    {
                        List<string> subscriberEmails = new List<string>();

                        foreach (WSNotificationSubscriberElement subscriberConfig in config.ContactNotificationSubscribers)
                        {
                            if (subscriberConfig.Enabled)
                            {
                                subscriberEmails.Add(subscriberConfig.EmailAddress);
                            }
                        }

                        messageVars = new NameValueCollection();
                        messageVars.Add("%%CONTACT_ID%%", contact.ContactId.ToString());
                        messageVars.Add("%%DATE%%", contact.CreatedDate.ToLongDateString());
                        messageVars.Add("%%NAME%%", contact.Name);
                        messageVars.Add("%%EMAIL_ADDRESS%%", contact.EmailAddress);
                        messageVars.Add("%%ORGANIZATION_NAME%%", String.IsNullOrEmpty(contact.OrganizationName) ? "NA" : contact.OrganizationName);
                        messageVars.Add("%%JOB_TITLE%%", String.IsNullOrEmpty(contact.JobTitle) ? "NA" : contact.JobTitle);
                        messageVars.Add("%%CITY%%", String.IsNullOrEmpty(contact.City) ? "NA" : contact.City);
                        messageVars.Add("%%IP_ADDRESS%%", String.IsNullOrEmpty(contact.IPAddress) ? "NA" : contact.IPAddress);
                        messageVars.Add("%%RELATIONSHIP%%", contact.Relationship.ToString());
                        messageVars.Add("%%COMMENTS%%", String.IsNullOrEmpty(contact.Comments) ? "NA" : contact.Comments);

                        MailManager.SendEmail("ContactReceived", subscriberEmails, null, messageVars);
                    }
                }
            }
        }
 public static void Submit(string list,Contact contact)
 {
     MailChimpListSubscription subscription = new MailChimpListSubscription();
     subscription.Email = contact.EmailAddress;
     subscription.ListId = list;
     subscription.MergeData = new List<KeyValuePair<string, object>>();
     subscription.MergeData.Add(new KeyValuePair<string, object>("NAME", contact.Name));
     subscription.MergeData.Add(new KeyValuePair<string, object>("Email", contact.EmailAddress));
     subscription.MergeData.Add(new KeyValuePair<string, object>("PHONE", contact.Phone));
     subscription.MergeData.Add(new KeyValuePair<string, object>("ORG", contact.OrganizationName));
     subscription.MergeData.Add(new KeyValuePair<string, object>("JOBTITLE", contact.JobTitle));
     subscription.MergeData.Add(new KeyValuePair<string, object>("CITY", contact.City));
     subscription.MergeData.Add(new KeyValuePair<string, object>("WEBSITE", contact.Website));
     subscription.MergeData.Add(new KeyValuePair<string, object>("REL", contact.Relationship));
     subscription.MergeData.Add(new KeyValuePair<string, object>("COMMENTS", contact.Comments));
     subscription.DoubleOptIn = true;
     subscription.ReplaceInterests = true;
     subscription.SendWelcome = false;
     subscription.UpdateExisting = false;
     MailChimpService service = new MailChimpService();
     service.Subscribe(subscription);
 }