title: New transaction is not allowed because there are other threads running in the session Linq to Entity Mvc C#
body: <p>I am Using Linq to Entity MVC and when I am trying to delte records from database I am getting this Exception.<br></p>
  
  <p><strong>New transaction is not allowed because there are other threads running in the session.</strong></p>
  
  <p>My code:</p>
  
  <pre><code>if (Request.Form["Enroll"] != null)
  {
      string[] selected = Request.Form["Enroll"].Split(',');
  
      if (selected != null)
      {
          if (selected.Count() != 0)
          {
              int k = 0;
              foreach (var item in selected)
              {
                  var TraineeId = Convert.ToInt32(item[k].ToString());
                  var sessionid = Convert.ToInt32(Session["user"].ToString());
  
                  var id = db.EnrollTrainee.Where(i =&gt; i.TraineeID == TraineeId
                                                  &amp;&amp; i.TrainerID == sessionid);
  
                  if (id != null)
                  {
                      foreach (var a in id)
                      {
                          //db.Database.Connection.Close();
                          EnrollTrainee delete = db.EnrollTrainee.Find(a.id);
                          db.EnrollTrainee.Remove(delete);
                          db.SaveChanges();   //Getting Exception Here                                        
                      }
                  }
                  k++;
              }
          }
      }
      populatelistbox();
      return View();
  }
  </code></pre>
  
  <p>Please Help.!!!
  Thanks in Advance.!!!</p>