title: Add Xelement in existing XDocument in C#
body: <p>I have XML with details. I want to copy the entire <code>&lt;Details&gt;</code> node and create updated <code>&lt;Details&gt;</code> node with the exact same attribute.</p>
  
  <p>My XML looks like this:</p>
  
  <pre><code>&lt;root&gt;        
      &lt;Details&gt;
          &lt;A.EMPLID&gt;0000177008&lt;/A.EMPLID&gt;
              &lt;G.LAST_NAME&gt;Huziak-Clark&lt;/G.LAST_NAME&gt;
              &lt;G.FIRST_NAME&gt;Tracy&lt;/G.FIRST_NAME&gt;      
      &lt;/Details&gt;      
  &lt;/root&gt;
  </code></pre>
  
  <p>I would like to create a new node like this</p>
  
  <pre><code>&lt;root&gt;        
      &lt;Details&gt;
              &lt;A.EMPLID&gt;0000177008&lt;/A.EMPLID&gt;
              &lt;G.LAST_NAME&gt;Huziak-Clark&lt;/G.LAST_NAME&gt;
              &lt;G.FIRST_NAME&gt;Tracy&lt;/G.FIRST_NAME&gt;      
      &lt;/Details&gt;  
      &lt;Newdetails&gt;
          &lt;Details&gt;
              &lt;A.EMPLID&gt;0000177008&lt;/A.EMPLID&gt;
              &lt;G.LAST_NAME&gt;Huziak-Clark&lt;/G.LAST_NAME&gt;
              &lt;G.FIRST_NAME&gt;Tracy&lt;/G.FIRST_NAME&gt;      
          &lt;/Details&gt;  
      &lt;/Newdetails&gt;
  &lt;/root&gt;
  </code></pre>
  
  <p>I have used <code>XElement</code> like this, but it is just adding <code>&lt;NewDeatils/&gt;</code> node in <code>XDocument</code> but not remaining nodes.</p>
  
  <pre><code>foreach(XElement e in XDocument.Descendants("Details"))
  {
       XDocument.Root.Element.Add("NewDetails",XElement("Deatils");
  }
  </code></pre>
  
  <p>How to select the entire <code>XElement</code> and append it under <code>&lt;Newdetails&gt;</code> node?</p>
  
  <p>Thanks!</p>