title: Operation is not valid due to the current state of the object in C# Entity Framework
body: <p>I have a method that takes in a form submission and submissions answers. 
  In order to save the submission answers to the database; I need to set the submission answers with a reference ID to the submission.</p>
  
  <p>I am attempting to do this but receiving the error listed in the title: 
  "Operation is not valid due to the current state of the object" and I am unsure why. </p>
  
  <p>I've tried to save everything to the database before adjusting any values; but that doesn't seem to help. I get another error saying that I am attempting to remove a foreign key. </p>
  
  <p>I imagine this is a db context issue. </p>
  
  <pre><code>public FormSubmission AddSubmission(FormSubmission submission, List&lt;FormSubmissionAnswer&gt; submissionAnswers, int CustomerId, string CustomerName)
      {
          Form form = GetForm(submission.FormId.ToString());
          //set submission values
          submission.FormTitle = form.Title1;
          submission.DateSubmitted = DateTime.Now;
          if (CustomerId &gt; 0)
              submission.PSMCustomerId = CustomerId;
          submission.CustomerName = CustomerName;
          base.SubscriptionDB.FormSubmissions.InsertOnSubmit(submission);
          base.SubscriptionDB.SubmitChanges();
  
          //need to update the submission answers FormSubmissionId            
          foreach (FormSubmissionAnswer answer in submissionAnswers)
              answer.FormSubmissionId = submission.Id; //erroring here
  
        base.SubscriptionDB.FormSubmissionAnswers.InsertAllOnSubmit(submissionAnswers);
          base.SubscriptionDB.SubmitChanges();
  
  }
  </code></pre>