public IRepository <T> Update(T obj, params Expression <Func <T, object> >[] modifiedProperties) { _table.Attach(obj); if (modifiedProperties == null || modifiedProperties.Count() == 0) { _db.Entry(obj).State = EntityState.Modified; } else { var entry = _db.Entry(obj); foreach (var modifiedProperty in modifiedProperties) { entry.Property(modifiedProperty).IsModified = true; } } return(this); }