title: Create Model From Another Controller
body: <p>I have a complex user type (<a href="https://stackoverflow.com/questions/18286793/users-with-different-capabilities">more info</a>) which may contain different information based on different types. Now, when I want to register the user, I want to add the necessary information in other database tables. Currently I'm trying to do this:</p>
  
  <h3>Models:</h3>
  
  <pre><code>public class NormalUser
  {
      [Key]
      public string Id { get; set; }
  
      //....
  
      [Required]
      public virtual User User { get; set; }
  }
  </code></pre>
  
  <h3>Controller</h3>
  
  <pre><code>                if (await Users.Create(user) &amp;&amp; await Secrets.Create(new UserSecret(model.UserName, model.Password)) &amp;&amp;
                      await Logins.Add(new UserLogin(user.Id, IdentityConfig.LocalLoginProvider, model.UserName)))
                  {
                      var normaluser = new NormalUser(model) { User = user };
                      db.NormalUsers.Add(normaluser);
                      db.SaveChanges();
                      //....
  </code></pre>
  
  <p>However, when I run this, I get 2 errors on the last line. One error is saying that the <code>Id</code> field of the <code>normaluser</code> should be unique and the other is saying that the <code>User</code> field should be unique. They are both required criteria, but I thought the first is handled by auto-increment of the <code>Id</code> field and I didn't expect the second one since I just created the <code>User</code>.</p>
  
  <p>Am I even doing the right thing by using this method?</p>
  
  <h2>Update:</h2>
  
  <p>Fixed the first one by changing the type of the <code>Id</code> field from <code>string</code> to <code>int</code></p>