private void SyncCorpMembers(CRONJob settings)
        {
            if (settings.Enabled)
            {
                try
                {
                    List<Member> members = Api.GetCorpMembers(Convert.ToInt64(Properties.Settings.Default.CorpAPI), Properties.Settings.Default.VCode);
                    if ((members != null) && (members.Count > 0))
                    {
                        using (var db = new ApplicationDbContext())
                        {
                            members.ForEach(member =>
                                db.CorpMembers.AddOrUpdate(member)
                            );
                            db.SaveChanges();

                            var membersToDelete = new List<Member>();
                            db.CorpMembers.ToList().ForEach(member =>
                            {
                                if (!members.Any(mem => mem.ID == member.ID))
                                {
                                    membersToDelete.Add(member);
                                }
                            });

                            membersToDelete.ForEach(member =>
                                db.CorpMembers.Remove(member)
                            );
                            settings.LastRun = DateTime.UtcNow;
                            db.SaveChanges();

                            var users = db.Users.ToList();
                            users.ForEach(usr =>
                            {
                                var member = members.Where(memb => memb.Name.ToLower() == usr.UserName.ToLower()).FirstOrDefault();
                                if (member != null)
                                {
                                    if (member.Name != usr.UserName)
                                    {
                                        usr.UserName = member.Name;
                                    }
                                    usr.GetDetails(true);
                                }
                            });
                            db.SaveChanges();
                        }
                    }
                }
                catch (Exception ex)
                {
                }
            }
        }
        private void CrossPost(CRONJob settings)
        {
            if (settings.Enabled)
            {
                //Plugin.SendDirectMessage("Executing Jarvis", "clydeenmarland", Properties.Settings.Default.SlackWebhook);
                try
                {
                    var client = new Client {
                        UserName = Properties.Settings.Default.JarvisEmail,
                        Password = Properties.Settings.Default.JarvisPassword
                    };
                    if (client.Logon())
                    {
                        var messages = client.GetMessages(Properties.Settings.Default.JarvisDiscordRoom);

                        if (settings.LastRun == null)
                        {
                            messages = messages.OrderBy(msg => msg.timestamp).ToList();
                            messages.Where(msg => ((DateTime.Now - msg.timestamp).Days < 1) && (msg.content.Contains("To: coalition_pings"))).ToList().ForEach(msg =>
                            {
                                var senderlines = msg.content.Split(new[] { "\n" }, StringSplitOptions.None);

                                var payload = new MessagePayload();
                                //payload.Text = string.Format("@channel: From {0}", msg.author.username);
                                payload.Text = "@channel: Coalition Broadcast";
                                payload.Attachments = new List<MessagePayloadAttachment>();
                                payload.Attachments.Add(new MessagePayloadAttachment()
                                {
                                    Text = new Censor().CensorText(string.Join("\n", senderlines.Skip(1))),
                                    Title = string.Format("{0}", msg.timestamp.ToString("yyyy-MM-dd HH:mm:ss")),
                                    //Title = string.Format("{0}: Message from {1}", msg.timestamp.ToString("yyyy-MM-dd HH:mm:ss"), msg.author.username),
                                    Colour = "#ff6600"
                                });
                                Plugin.SendToRoom(payload, Properties.Settings.Default.JarvisSlackRoom, Properties.Settings.Default.SlackWebhook, msg.author.username);

                                foreach(var webhook in Properties.Settings.Default.DiscordLinkSlackWebhooks)
                                {
                                    Plugin.SendToRoom(payload, Properties.Settings.Default.JarvisSlackRoom, webhook, msg.author.username);
                                }
                            });
                        }
                        else
                        {
                            messages = messages.OrderBy(msg => msg.timestamp).ToList();
                            messages = messages.Where(msg =>
                            (msg.timestamp > settings.LastRun.Value
                            &&
                            (msg.content.Contains("To: coalition_pings"))
                            )).ToList();

                            messages.ForEach(msg =>
                            {
                                var senderlines = msg.content.Split(new[] { "\n" }, StringSplitOptions.None);
                                var payload = new MessagePayload();
                                //payload.Text = string.Format("@channel: From {0}", msg.author.username);
                                payload.Text = "@channel: Coalition Broadcast";
                                payload.Attachments = new List<MessagePayloadAttachment>();
                                payload.Attachments.Add(new MessagePayloadAttachment()
                                {
                                    Text = new Censor().CensorText(string.Join("\n", senderlines.Skip(1))),
                                    Title = string.Format("{0}", msg.timestamp.ToString("yyyy-MM-dd HH:mm:ss")),
                                    //Title = string.Format("{0}: Message from {1}", msg.timestamp.ToString("yyyy-MM-dd HH:mm:ss"), msg.author.username),
                                    Colour = "#ff6600"
                                });
                                Plugin.SendToRoom(payload, Properties.Settings.Default.JarvisSlackRoom, Properties.Settings.Default.SlackWebhook, msg.author.username);
                                foreach (var webhook in Properties.Settings.Default.DiscordLinkSlackWebhooks)
                                {
                                    Plugin.SendToRoom(payload, Properties.Settings.Default.JarvisSlackRoom, webhook, msg.author.username);
                                }
                            });
                        }
                        settings.LastRun = messages.LastOrDefault().timestamp.AddMilliseconds(-messages.LastOrDefault().timestamp.Millisecond).AddMinutes(1);

                        client.LogOut();
                    }
                }
                catch (Exception ex)
                {
                    //Plugin.SendDirectMessage(ex.Message, "clydeenmarland", Properties.Settings.Default.SlackWebhook);
                }
            }
        }