public void Delete(T entityToDelete)
 {
     if (context.Entry(entityToDelete).State == EntityState.Detached)
     {
         dbSet.Attach(entityToDelete);
     }
     dbSet.Remove(entityToDelete);
 }
        public void Update(int id, TEntity entity)
        {
            var item = GetByID(id);

            if (item == null)
            {
                throw new InvalidOperationException("Unable to update: Entry doesn't exist");
            }
            context.Entry(item).CurrentValues.SetValues(entity);
            context.SaveChanges();
        }