public NotificationConfiguration UpdateNotificationConfiguration(Dictionary<string, object> data)
        {
            var notificationAction = GetNotificationInstance(data);
            var id = int.Parse(data.First(x => x.Key.Equals("Id")).Value.ToString());

            using (var ctx = new MailModelContainer())
            {
                var selection = ctx.NotificationConfigurations.Find(id);
                selection.ConfigurationXml = notificationAction.Serialize();
                selection.ImapMailBoxConfigurationId = int.Parse(data.First(x => x.Key.Equals("MailBoxId")).Value.ToString());

                ctx.Entry(selection).State = EntityState.Modified;
                ctx.SaveChanges();
                return selection;
            }
        }
        public IClientConfiguration Put(ClientConfigurationDto conf)
        {
            IClientConfiguration selection;

            using (var ctx = new MailModelContainer())
            {
                selection = ctx.ImapMailBoxConfigurations.Find(conf.Id);
                ctx.Entry(selection).CurrentValues.SetValues(conf);
                ctx.SaveChanges();
            }

            InboxWatcher.MailBoxes.Remove(conf.Id);
            Task.Factory.StartNew(async () => { await InboxWatcher.ConfigureMailBox(conf); });
            return selection;
        }