public void Delete(int id) { T entity = _context.Find <T>(id); if (entity == null) { throw new RecordNotFoundException($"Entity record with Id {id} cannot find."); } _context.Remove(entity); _context.SaveChanges(); }