public virtual void Delete(TEntity entityToDelete) { if (_ticketContext.Entry(entityToDelete).State == EntityState.Detached) { dbSet.Attach(entityToDelete); } dbSet.Remove(entityToDelete); }