internal static RestGuildSnapshotRole Create(GuildSnapshotRoleJson role)
        {
            RestGuildSnapshotRole entity = new RestGuildSnapshotRole
            {
                Color       = role.Color,
                Hoist       = role.Hoist,
                Id          = int.Parse(role.Id.ToString()),
                Mentionable = role.Mentionable,
                Name        = role.Name,
                Permissions = role.Permissions
            };

            return(entity);
        }
        internal static RestGuildSnapshot Create(BaseDiscordClient discord, Model model)
        {
            RestGuildSnapshot entity = new RestGuildSnapshot
            {
                Name       = model.Name,
                AFKTimeout = model.AFKTimeout,
                DefaultMessageNotifications = model.DefaultMessageNotifications,
                Description           = model.Description,
                ExplicitContentFilter = model.ExplicitContentFilter,
                IconHash           = model.IconHash,
                PreferredLocale    = model.PreferredLocale,
                Region             = model.Region,
                SystemChannelFlags = model.SystemChannelFlags,
                VerificationLevel  = model.VerificationLevel
            };

            if (model.AFKChannelId.HasValue)
            {
                entity.AFKChannelId = model.AFKChannelId.Value;
            }
            if (model.SystemChannelId.HasValue)
            {
                entity.SystemChannelId = model.SystemChannelId.Value;
            }

            ImmutableDictionary <int, RestGuildSnapshotRole> .Builder roles = ImmutableDictionary.CreateBuilder <int, RestGuildSnapshotRole>();
            if (model.Roles != null)
            {
                for (int i = 0; i < model.Roles.Length; i++)
                {
                    roles[model.Roles[i].Id] = RestGuildSnapshotRole.Create(model.Roles[i]);
                }
            }
            entity._roles = roles.ToImmutable();

            ImmutableDictionary <int, RestGuildSnapshotChannel> .Builder channels = ImmutableDictionary.CreateBuilder <int, RestGuildSnapshotChannel>();
            if (model.Channels != null)
            {
                for (int i = 0; i < model.Channels.Length; i++)
                {
                    channels[model.Channels[i].Id] = RestGuildSnapshotChannel.Create(model.Channels[i]);
                }
            }
            entity._channels = channels.ToImmutable();

            return(entity);
        }