public async Task AddBan(UserModerationEntry entry, DateTimeOffset banUntil)
        {
            moderationEntries.Add(entry);
            BannedUntil = banUntil;
            MutedUntil  = null;
            if (banUntil < DateTimeOffset.MaxValue)
            {
                GuildModerationLog.AddTimeLimitedInfractionReference(this);
            }
            await Save();

            await Parent.InvokeUserModerationLogModifiedEvents(this, entry);
        }
        public async Task AddMute(SocketGuildUser target, DateTimeOffset muteUntil, UserModerationEntry?entry = null)
        {
            // Generate UserModerationEntry

            if (!entry.HasValue)
            {
                SocketGuildUser self = target.Guild.GetUser(BotCore.Client.CurrentUser.Id);

                if (muteUntil == DateTimeOffset.MaxValue)
                {
                    entry = new UserModerationEntry(target.Guild.Id, ModerationType.Muted, DateTimeOffset.UtcNow, self, "Automatic Mute", "Duration: perma");
                }
                else
                {
                    entry = new UserModerationEntry(target.Guild.Id, ModerationType.Muted, DateTimeOffset.UtcNow, self, "Automatic Mute", "Duration: " + (muteUntil - DateTimeOffset.UtcNow).ToHumanTimeString());
                }
            }

            moderationEntries.Add(entry.Value);

            // Edit user roles

            List <SocketRole> roles = new List <SocketRole>(target.Roles.Count - 1);

            foreach (SocketRole role in target.Roles)
            {
                if (!role.IsEveryone)
                {
                    roles.Add(role);
                }
            }

            SocketRole muteRole = target.Guild.GetRole(SettingsModel.MuteRole);

            try
            {
                await target.RemoveRolesAsync(roles);

                if (muteRole != null)
                {
                    await target.AddRoleAsync(muteRole);
                }
            }
            catch (Exception e)
            {
#if DEBUG
                throw;
#endif
            }

            // Edit UserModerationLog

            MutedUntil   = muteUntil;
            rolesPreMute = new List <ulong>(roles.Select(role => role.Id));
            if (muteUntil < DateTimeOffset.MaxValue)
            {
                GuildModerationLog.AddTimeLimitedInfractionReference(this);
            }

            // Save

            await Save();

            await Parent.InvokeUserModerationLogModifiedEvents(this, entry.Value);
        }