title: EFCore- Save Entity with child entity records
body: <p>Here are my models:</p>
  
  <pre><code>    public partial class UserDTO
      {
       public int UserId { get; set; }
       public ICollection&lt;Userskills&gt; Userskills { get; set; }
      }
  
   public partial class SkillsmasterDTO
      {
          public sbyte SkillId { get; set; }
          public string Skill { get; set; }
          public ICollection&lt;Userskills&gt; Userskills { get; set; }
     }
  
  
    public partial class UserskillsDTO
      {
          public int UserId { get; set; }
          public sbyte SkillId { get; set; }
  
          public SkillsmasterDTO Skill { get; set; }
          public UsermasterDTO User { get; set; }
      }
  
   public class UserMaster
      {
       public int UserId { get; set; }
       public List&lt;UserSkills&gt; UserSkills{get;set;}
      //other fields
      }
  
   public class SkillsMaster
   {
          public sbyte SkillId { get; set; }
          public string Skill { get; set; }
   }
  
      public class UserSkills
      {
          public int UserId { get; set; }
          public sbyte SkillId { get; set; }
          public string Skill { get; set; }
      }
  </code></pre>
  
  <p>I want to save UserMaster, and along with that I want to save UserSkills also.
  I am sending data in following format:</p>
  
  <pre><code>{"FirstName": "Priya",
  "LastName": "Dave",
  "Email":"priya.dave@xyz.com",
  "Password":"123456",
  "ContactNo":"1234",
  "RoleId":1,
  "CreatedBy":15,
  "UserTypeId":2,
  "LocationId":1,
  "BandId":1,
  "PostId":1,
  "IsActive":1,
  "UserSkills":[{"SkillId":1}]
  }
  </code></pre>
  
  <p>Code I've written for save is:</p>
  
  <pre><code> var insertedEmployee= unitOfWork.UserRepository.Add(Mapper.Map&lt;Usermaster&gt;(employee));
  
  _unitOfWork.Save();
  </code></pre>
  
  <p>It is saving user details but UserSkills is not getting saved. How can I do that? I went through some blogs but not able to find proper solution.</p>