public T Update(T record) { _table.AddOrUpdate(record); if (_context.Entry(record).State == EntityState.Detached) { _context.Entry(record).State = EntityState.Modified; _table.Attach(record); } _context.SaveChanges(); return(record); }