html document parsing issue
===

I have an issue with HtmlAgilityPack. I load the document from the stream and just save it without doing any kind of manipulation on the document. The document contains `header` , `body` , `footer`.The structure of header and footer is exactly same. And then return the `Filecontentresult` object. Code :

    HtmlDocument ndoc = new HtmlDocument();
    ndoc.Load(stream);                        //load from stream                          
    
    using (MemoryStream ms = new MemoryStream())
    {
       ndoc.Save(ms);                         //save back in stream
       ms.Seek(0, System.IO.SeekOrigin.Begin);
       fileBytes = ms.ToArray();
    }
    
    FileContentResult file = File(fileBytes, "text/html");
    return file;

When i saw the document in the browser then everything was there but footer disappeared. Then i used `OptionOutputAsXml` by this footer comes but the contents of footer was still disappeared. 

Now if i used the following code. Just removing the htmlagilitypack. Directly creating the FileContentResult from the stream. Then everything is perfect and on there own positions.Code:  


    using (MemoryStream ms = new MemoryStream())
    {
       stream.CopyTo(ms);            //copy stream contents in memorystream object
       fileBytes = ms.ToArray();
    }
    
    FileContentResult file = File(fileBytes, "text/html");
    return file;

Can anybody please explain me whats the problem with HtmlAgilityPack ?