public static async Task UpdateCategory(this AppDbContext db, TableCategory category) { if (await category.Validate(db)) { db.TableCategories.Update(category); await db.SaveChangesAsync(); } }