I have an XML file that looks like this

```
<modules>
<level4>
<module>
  <name>Programming Principles I</name>
  <credit>20</credit>
  <assessments>

    <assessment>
      <assessment_name>Course Work 1</assessment_name>
      <weight>50</weight>
      <passing>55</passing>
      <obtain>55</obtain>
    </assessment>
    <assessment>
      <assessment_name>Course Work 2</assessment_name>
      <weight>50</weight>
      <passing>55</passing>
      <obtain>55</obtain>
    </assessment>

  </assessments>
</module>
</level4>
</modules>

```

Whilst, getting into `assessment` childs of parent `assessments` it returns null..

using this code

```
XDocument xml = XDocument.Load("module.xml");
var result = xml.Descendants("module")
                         .FirstOrDefault(x => (string)x.Element("name") == "Programming Principles I");
var assessments = result.Element("assessments");
var assessment = assessments.Descendants("assessment");
foreach(var a in assessment)
{
    a.Remove();
}

```

At this `assessment` variable I am getting null value exception. The LINQ query works fine but the next two lines I am uncertain. I am actually, removing all the nodes present inside `assessments` node.