title: MVC Add Multiple Entries to Database with one action
body: <p>I am attempting to enter new entries into a table called <code>EmployeeCourseStatus</code> when another table <code>Course</code> has been edited.</p>
  
  <p>Whenever a <code>Course</code> entry is edited to increase its Revision by 1, I need it to update the <code>EmployeeCourseStatus</code> so it will keep the previous course history for each employee and add a duplicate entry with the new revision number. </p>
  
  <pre><code>    [HttpPost]
      [ValidateAntiForgeryToken]
      public ActionResult Edit([Bind(Include = "CourseID,CourseName,SiteID,ValidFor,Rev,EffectiveDate,ExpiredDate")] Course course, EmployeeCourseStatu employeeCourseStatu,CourseViewModel courseViewModel)
      {
          if (ModelState.IsValid)
          {
              var OringinalRev = db.Courses.AsNoTracking().Where(P =&gt; P.CourseID == course.CourseID).Select(e =&gt; e.Rev)?.FirstOrDefault();
  
              if (course.Rev == OringinalRev + 1)
              { 
                  foreach (var item in db.EmployeeCourseStatus.Where(e =&gt; e.CourseID==course.CourseID))
                  {
                      employeeCourseStatu.EmployeeID = item.EmployeeID;
                      employeeCourseStatu.CourseID = item.CourseID;
                      employeeCourseStatu.Status = null;
                      employeeCourseStatu.ValidFor = item.ValidFor;
                      employeeCourseStatu.CompletionDate = null;
                      employeeCourseStatu.Rev = item.Rev + 1;
                      db.EmployeeCourseStatus.Add(employeeCourseStatu);
                  }
              }
  
              db.Entry(course).State = EntityState.Modified;
              db.SaveChanges();
              return RedirectToAction("Index");
          }
          ViewBag.SiteID = new SelectList(db.Sites, "SiteID", "SiteName", course.SiteID);
          return View(course);
      }
  </code></pre>
  
  <p>The Code above only saves one entry to the database, which I understand as I am replacing the values each time I'm looping through the table.</p>
  
  <p>How can I have it so it adds each iteration to the database?</p>