public async Task <IResult <List <UserRulesExceeded> > > GetUsersWhoExceedsRules(string channelName, IApplicationContext context)
        {
            var suspensionsForSystem = await suspensionRepository.GetSuspensions(datetimeProvider.UtcNow.AddYears(-1)).ConfigureAwait(false);

            var usersFromSuspensions = suspensionsForSystem.Select(x => x.Username);

            var channel = await channelRepository.GetChannel(channelName).ConfigureAwait(false);

            if (!context.HaveAccessTo(channel))
            {
                return(Result <List <UserRulesExceeded> > .Unauthorized());
            }

            var allSuspensionsForChannel = await suspensionRepository.GetSuspensionsForChannel(channelName).ConfigureAwait(false);

            var allValidAuditedSuspensionForChannel = allSuspensionsForChannel.Where(x => !x.InvalidSuspension && x.Audited);

            var usersWhoExceeded = new List <UserRulesExceeded>();

            foreach (var user in usersFromSuspensions.Distinct(StringComparer.OrdinalIgnoreCase))
            {
                // If we already have a ban
                if (allValidAuditedSuspensionForChannel.Any(x => string.Equals(x.Username, user, StringComparison.OrdinalIgnoreCase) && x.SuspensionType == SuspensionType.Ban))
                {
                    continue;
                }

                var suspensionsForUser = await suspensionRepository.GetSuspensionsForUser(user).ConfigureAwait(false);

                var report = new UserReport(user, suspensionsForUser);

                foreach (var rule in channel.ChannelRules.Where(x => x.ActionOnTrigger == ChannelRuleAction.Ban))
                {
                    if (report.Exceeds(rule))
                    {
                        var userRulesExceeded = usersWhoExceeded.Find(x => string.Equals(x.Username, user, StringComparison.OrdinalIgnoreCase)) ?? new UserRulesExceeded {
                            Username = user
                        };

                        usersWhoExceeded.Remove(userRulesExceeded);

                        userRulesExceeded.RulesBroken.Add(rule);
                        usersWhoExceeded.Add(userRulesExceeded);
                    }
                }
            }

            return(Result <List <UserRulesExceeded> > .Succeeded(usersWhoExceeded));
        }
        public async Task <IResult <List <Suspension> > > GetAllSuspensionsAsync(string channelOfOrigin, IApplicationContext context)
        {
            var channel = await channelRepository.GetChannel(channelOfOrigin).ConfigureAwait(false);

            if (channel == null)
            {
                return(Result <List <Suspension> > .NoContentFound());
            }

            if (!context.HaveAccessTo(channel))
            {
                return(Result <List <Suspension> > .Unauthorized());
            }

            var dataForUser = await suspensionRepository.GetSuspensionsForChannel(channelOfOrigin).ConfigureAwait(false);

            if (dataForUser.Count > 0)
            {
                return(Result <List <Suspension> > .Succeeded(dataForUser.OrderByDescending(x => x.Timestamp).ToList()));
            }

            return(Result <List <Suspension> > .NoContentFound());
        }