title: Value cannot be null. Parameter name: entity
body: <p>I have the following view (basic "edit" template)</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>  @model SuccessStories.Models.Testimonials
  
  @using (Html.BeginForm())
  {
      @Html.AntiForgeryToken()
      
      &lt;div class="form-horizontal"&gt;
          &lt;h4&gt;Testimonials&lt;/h4&gt;
          &lt;hr /&gt;
          @Html.ValidationSummary(true, "", new { @class = "text-danger" })
          @Html.HiddenFor(model =&gt; model.Id)
  
          &lt;div class="form-group"&gt;
              @Html.LabelFor(model =&gt; model.Testimonial, htmlAttributes: new { @class = "control-label col-md-2" })
              &lt;div class="col-md-10"&gt;
                  @Html.EditorFor(model =&gt; model.Testimonial, new { htmlAttributes = new { @class = "form-control" } })
                  @Html.ValidationMessageFor(model =&gt; model.Testimonial, "", new { @class = "text-danger" })
              &lt;/div&gt;
          &lt;/div&gt;
  
          &lt;div class="form-group"&gt;
              &lt;div class="col-md-offset-2 col-md-10"&gt;
                  &lt;input type="submit" value="Save" class="btn btn-default" /&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  }
  
  &lt;div&gt;
      @Html.ActionLink("Back to List", "Index")
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>And the following actionresult in my controller:</p>
  
  <pre><code>[HttpGet]
      public ActionResult Edit(int id)
      {
              TestimonialsContext testContext = new TestimonialsContext();
              Testimonials testimonials = testContext.testimonialContext.Find(id);
              return View(testimonials);  
      }
  
      [HttpPost]
      public ActionResult Edit(Testimonials testimonial)
      {
          TestimonialsContext testContext = new TestimonialsContext();
          testContext.Entry(testimonial).State = EntityState.Modified;
          testContext.SaveChanges();
  
          return RedirectToAction("Index");
      }
  </code></pre>
  
  <p>The error is on this line:</p>
  
  <pre><code>testContext.Entry(testimonial).State = EntityState.Modified;
  </code></pre>
  
  <p>The error I get is "Value cannot be null.
  Parameter name: entity</p>
  
  <p>Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. </p>
  
  <p>Exception Details: System.ArgumentNullException: Value cannot be null.
  Parameter name: entity"</p>
  
  <p>Please help. I've looked this up but can't find a solution that would work for me. Thanks!</p>