//When the program start ther will be not xml file existen therefore we create one with a default administrator public void WriteAssignments(AssignmentSet newAssgnment) { if (File.Exists(_fileName) == true) { if (fileIsOpen = OpenFile(_fileName)) { //make sure that count should be zero //as the first time we create a program we make a admin a default user var newAssignmentNode = new XElement("Assignment", new XElement("AssignmentName", newAssgnment.AssignmentName), //new XElement("JungleName", ""), new XElement("BottomRange", newAssgnment.BottomRange), new XElement("TopRange", newAssgnment.TopRange), new XElement("Problems", newAssgnment.NumberofProblems), new XElement("Goal", newAssgnment.Goal), new XElement("Attempts", newAssgnment.Attempts) ); xmlDocument.Element("Assignments").Add(newAssignmentNode); xmlDocument.Save(_fileName); RepNumber++; } } else { CreateNewAssg(); } }