public virtual void Update(T entity)
 {
     context.Set <T>().Attach(entity);
     context.Entry(entity).State = EntityState.Modified;
     context.SaveChanges();
 }