public void EnsureCorrectDatabaseState() { foreach (var gc in GuildConfigs.Include(g => g.LogSetting)) { if (gc.LogSetting == null) { gc.LogSetting = new LogSetting(); GuildConfigs.Update(gc); } } SaveChanges(); }