title: I am getting error of conflict in asp.net MVC5
body: <p>I am getting error of conflict in asp.net MVC5</p>
  
  <p>here is my model class of Form model</p>
  
  <pre><code>[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
          [Key]
          public Guid FormId { get; set; }
          public Guid EntityBlockId { get; set; } // LinkToEntityBlockId
          public virtual EntityBlock EntityBlock { get; set; }
  </code></pre>
  
  <p>here is my model class of EntityBlock model</p>
  
  <pre><code>[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
          [Key]
          public Guid EntityBlockId { get; set; }
  
          public virtual ICollection&lt;Form&gt; Form { get; set; }
  </code></pre>
  
  <p>and inserting the value like below:</p>
  
  <pre><code>FormStaticMethodsController formStaticMethodsControllerObj = new FormStaticMethodsController();
  
          Form form = new Form();
                      form.EntityBlockId = linkToBlockId;
      formStaticMethodsControllerObj.CreateForm(form);
  </code></pre>
  
  <p>method is:</p>
  
  <pre><code> public Guid CreateForm(Form form)
              {
                  db.Forms.Add(form);
                  db.SaveChanges();
  
                  return form.FormId;
              }
  </code></pre>
  
  <p>an the error is:</p>
  
  <p>The INSERT statement conflicted with the FOREIGN KEY constraint "FK_dbo.Form_dbo.EntityBlock_EntityBlockId". The conflict occurred in database "aspnet-Planetskool-20150303080110", table "dbo.EntityBlock", column 'EntityBlockId'.
  The statement has been terminated.</p>
  
  <p><img src="https://i.stack.imgur.com/DTNyA.png" alt="enter image description here"></p>