public async Task <IActionResult> UpdateSpecificItem([FromRoute] ulong guildId, [FromBody] GuildConfigForPutDto newValue)
        {
            await RequirePermission(guildId, DiscordPermission.Admin);

            if (_config.IsDemoModeEnabled())
            {
                if (!(await GetIdentity()).IsSiteAdmin())
                {  // siteadmins can overwrite in demo mode
                    throw new BaseAPIException("Demo mode is enabled. Only site admins can edit guild configs.", APIError.NotAllowedInDemoMode);
                }
            }

            GuildConfig guildConfig = await GetRegisteredGuild(guildId);

            guildConfig.ModRoles          = newValue.ModRoles;
            guildConfig.AdminRoles        = newValue.AdminRoles;
            guildConfig.ModNotificationDM = newValue.ModNotificationDM;
            guildConfig.MutedRoles        = newValue.MutedRoles;
            guildConfig.ModInternalNotificationWebhook = newValue.ModInternalNotificationWebhook;
            if (guildConfig.ModInternalNotificationWebhook != null)
            {
                guildConfig.ModInternalNotificationWebhook = guildConfig.ModInternalNotificationWebhook.Replace("discord.com", "discordapp.com");
            }
            guildConfig.ModPublicNotificationWebhook = newValue.ModPublicNotificationWebhook;
            if (guildConfig.ModPublicNotificationWebhook != null)
            {
                guildConfig.ModPublicNotificationWebhook = guildConfig.ModPublicNotificationWebhook.Replace("discord.com", "discordapp.com");
            }
            guildConfig.StrictModPermissionCheck = newValue.StrictModPermissionCheck;
            guildConfig.ExecuteWhoisOnJoin       = newValue.ExecuteWhoisOnJoin;
            guildConfig.PublishModeratorInfo     = newValue.PublishModeratorInfo;
            guildConfig.PreferredLanguage        = newValue.PreferredLanguage;

            return(Ok(await GuildConfigRepository.CreateDefault(_serviceProvider).UpdateGuildConfig(guildConfig)));
        }
        public async Task <IActionResult> UpdateSpecificItem([FromRoute] string guildid, [FromBody] GuildConfigForPutDto newValue)
        {
            // check if request is made by a site admin
            logger.LogInformation($"{HttpContext.Request.Method} {HttpContext.Request.Path} | Incoming request.");
            Identity currentIdentity = await identityManager.GetIdentity(HttpContext);

            User currentUser = await currentIdentity.GetCurrentDiscordUser();

            if (currentUser == null)
            {
                logger.LogInformation($"{HttpContext.Request.Method} {HttpContext.Request.Path} | 401 Unauthorized.");
                return(Unauthorized());
            }
            if (!config.Value.SiteAdminDiscordUserIds.Contains(currentUser.Id))
            {
                logger.LogInformation($"{HttpContext.Request.Method} {HttpContext.Request.Path} | 401 User unauthorized.");
                return(Unauthorized());
            }
            // ========================================================

            GuildConfig guildConfig = await database.SelectSpecificGuildConfig(guildid);

            if (guildConfig == null)
            {
                logger.LogInformation($"{HttpContext.Request.Method} {HttpContext.Request.Path} | 404 ModCase not found.");
                return(NotFound());
            }

            guildConfig.ModRoleId         = newValue.ModRoleId;
            guildConfig.AdminRoleId       = newValue.AdminRoleId;
            guildConfig.MutedRoleId       = newValue.MutedRoleId;
            guildConfig.ModNotificationDM = newValue.ModNotificationDM;
            guildConfig.ModInternalNotificationWebhook = newValue.ModInternalNotificationWebhook;
            guildConfig.ModPublicNotificationWebhook   = newValue.ModPublicNotificationWebhook;

            database.UpdateGuildConfig(guildConfig);
            await database.SaveChangesAsync();

            logger.LogInformation($"{HttpContext.Request.Method} {HttpContext.Request.Path} | 200 Resource updated.");
            return(Ok());
        }