public TEntity Update(TEntity entity) { if (entity == null) { throw new ArgumentNullException($"{nameof(Update)} entity must not be null"); } try { _context.Update(entity); // await _context.SaveChangesAsync(); return(entity); } catch (Exception) { throw new Exception($"{nameof(entity)} could not be updated"); } }