/// <summary>
        /// Jonathan Sanborn
        ///
        /// Creates the Parent node files for the xml data
        /// </summary>
        /// <param name="fileName">the name of the file to create</param>
        /// <param name="fileType">the type of file to create</param>
        private void CreateFile(string fileName, MMFileType fileType)
        {
            XDocument xFile = new XDocument( );

            switch (fileType)
            {
            case MMFileType.User:
                xFile.Add(
                    new XElement("Users",
                                 new XElement("User",
                                              new XElement("ID", Guid.NewGuid().ToString()),
                                              new XElement("Type", UserType.Administrator),
                                              new XElement("ScreenName", Properties.Settings.Default.DefaltAdminName),
                                              new XElement("Name",
                                                           new XElement("First", Properties.Settings.Default.DefaltAdminName),
                                                           new XElement("Last", Properties.Settings.Default.DefaltAdminName)
                                                           ),
                                              new XElement("Password", Properties.Settings.Default.DefaltAdminName),
                                              new XElement("LoginRecords", string.Empty)
                                              )
                                 )
                    );
                break;

            case MMFileType.ProblemSet:
                xFile.Add(new XElement("ProblemSets", string.Empty));
                break;

            case MMFileType.Assignment:
                xFile.Add(new XElement("Assignments", string.Empty));
                break;

            case MMFileType.AssignmentAttempt:
                xFile.Add(new XElement("AssignmentAttempts", string.Empty));
                break;

            case MMFileType.None:
            default:
                break;
            }
            xFile.Save(fileName);
        }
        /// <summary>
        /// Jonathan Sanborn
        /// 
        /// Creates the Parent node files for the xml data
        /// </summary>
        /// <param name="fileName">the name of the file to create</param>
        /// <param name="fileType">the type of file to create</param>
        private void CreateFile(string fileName, MMFileType fileType)
        {
            XDocument xFile = new XDocument();

            switch (fileType)
            {

                case MMFileType.User:
                    xFile.Add(
                        new XElement("Users",
                            new XElement("User",
                                new XElement("ID", Guid.NewGuid().ToString()),
                                new XElement("Type", UserType.Administrator),
                                new XElement("ScreenName", Properties.Settings.Default.DefaltAdminName),
                                new XElement("Name",
                                    new XElement("First", Properties.Settings.Default.DefaltAdminName),
                                    new XElement("Last", Properties.Settings.Default.DefaltAdminName)
                                ),
                                new XElement("Password", Properties.Settings.Default.DefaltAdminName),
                                new XElement("LoginRecords", string.Empty),
                                new XElement("Rewards", uint.MinValue)
                            )
                        )
                    );
                    break;
                case MMFileType.ProblemSet:
                    xFile.Add(new XElement("ProblemSets", string.Empty));
                    break;
                case MMFileType.Assignment:
                    xFile.Add(new XElement("Assignments", string.Empty));
                    break;
                case MMFileType.AssignmentAttempt:
                    xFile.Add(new XElement("AssignmentAttempts", string.Empty));
                    break;
                case MMFileType.None:
                default:
                    break;
            }
            xFile.Save(fileName);
        }
        /// <summary>
        /// Jonathan Sanborn
        ///
        /// Opens the passed in XML filename
        /// </summary>
        /// <param name="fileName">The name of the file to open</param>
        /// <param name="fileType">The type that the file is</param>
        /// <returns>The opened files</returns>
        private XDocument OpenFile(string fileName, MMFileType fileType)
        {
            XDocument doc;
            bool      schemaError = false;

            if (!File.Exists(fileName))
            {
                CreateFile(fileName, fileType);
            }

            try
            {
                doc = XDocument.Load(fileName);
                doc.Validate(schemas, (o, e) => { schemaError = true; });

                if (schemaError)
                {
                    MessageBox.Show("XML data file has been altered or corrupted.\n"
                                    + "Please correct the file errors or delete the files from the system.\n"
                                    + "CAUTION: Deletion of file will result in data loss.\n"
                                    + "Filename: " + fileName + "\n"
                                    + "Date: " + DateTime.Now.ToString(),
                                    "XML Schema Fail", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    return(null);
                }
                else
                {
                    return(XDocument.Load(fileName));
                }
            }
            catch (System.IO.IOException ex)
            {
                System.Diagnostics.Debug.Write(ex.Message);
                return(null);
            }
        }
        /// <summary>
        /// Jonathan Sanborn
        /// 
        /// Opens the passed in XML filename
        /// </summary>
        /// <param name="fileName">The name of the file to open</param>
        /// <param name="fileType">The type that the file is</param>
        /// <returns>The opened files</returns>
        private XDocument OpenFile(string fileName, MMFileType fileType)
        {
            XDocument doc;
            bool schemaError = false;

            if (!File.Exists(fileName))
            {
                CreateFile(fileName, fileType);
            }
           
            try
            {
                doc = XDocument.Load(fileName);
                doc.Validate(schemas, (o,e) => { schemaError = true; } );

                if (schemaError)
                {
                    MessageBox.Show("XML data file has been altered or corrupted.\n" 
                            + "Please correct the file errors or delete the files from the system.\n" 
                            + "CAUTION: Deletion of file will result in data loss.\n"
                            + "Filename: " + fileName + "\n"
                            + "Date: " + DateTime.Now.ToString(),
                            "XML Schema Fail", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    return null;
                }
                else
                {
                    return XDocument.Load(fileName);
                }
            }
            catch (System.IO.IOException ex)
            {
                System.Diagnostics.Debug.Write(ex.Message);
                return null;
            }

        }