title: Updating an item and changing foreign key
body: <p>Have <code>subjects</code> and <code>category</code> tables. </p>
  
  <p>In the <code>subjects</code> table I have a <code>CategoryId</code> column and it is a foreign key to the <code>category</code> table.</p>
  
  <p>When I try to update a subject using the code shown here, nothing happens:</p>
  
  <pre><code>Subject subject;
  
  using (var ctx = new SubjectEntities())
  {
      subject = ctx.Subjects.Where(s =&gt; s.CategoryId == kategorijaId).FirstOrDefault&lt;Subject&gt;();
  
      if (subject != null)
      { 
          subject.CategoryId = kategorijaId;
          subject.FullName = ime;
          subject.WebSite = web;
          subject.PhoneNumber = tel;
          subject.E_MAIL = mejl;
      }
  
      ctx.SaveChanges();
  }
  </code></pre>
  
  <p>Some help ? </p>
  
  <p>Thank you!</p>