/// <summary>
        /// Searches the list of XMLRecords based on the passed ID
        /// </summary>
        /// <param name="ID">a CSV string with all the IDs of the XML record to be found</param>
        /// <returns>the index of the XMLTree if found else -1</returns>
        public int IndexOf(string ID)
        {
            if (XMLRecordList == null)
            {
                return(-1);
            }
            XMLRecord searchID = new XMLRecord(ID);

            return(XMLRecordList.IndexOf(searchID));
        }
        /// <summary>
        /// Writes an XMLRecord based on the processtype
        /// </summary>
        /// <param name="XMLRec"></param>
        /// <param name="Type">Processtype. <see cref="ProcessType"/></param>
        /// <returns>the filename of the written file</returns>
        private string Write(XMLRecord XMLRec, ProcessType Type)
        {
            // Check if a folders exists with the same name as _filename. If not, create it

            if (!Directory.Exists(_filename))
            {
                CreateCompressedDir(_filename);
            }

            //write XMLRecord to that directory. use 'cleaned' tags as filename.
            //'Clean' means that all characters that aren't allowed in a filename like \/:* are replaced with underscore
            List <string> IDValues = XMLRec.getIDList();


            StringBuilder filename = new StringBuilder("");

            filename.AppendFormat("{0}\\{1}\\{2}_{3}", curDir, _filename, cleanFilename(_containerTags[0]), cleanFilename(XMLRecord.getIDTagString(_IDTags, IDValues)));
            // Console.WriteLine(filename.ToString());
            string XMLFilename = filename.ToString();

            if (XMLFilename.Length + postfix.Length > maxFilenameLength)
            {
                // Console.WriteLine(XMLFilename);
                XMLFilename = XMLFilename.Substring(0, maxFilenameLength - trunc.Length - postfix.Length - 1);
                XMLFilename = String.Concat(XMLFilename, trunc);
            }
            XMLFilename = String.Concat(XMLFilename, postfix);
            if (XMLFilename.Substring(0, 1) == "_")
            {
                Console.WriteLine(XMLFilename);
            }

            if (Type == ProcessType.AnonymizeToFiles)
            {
                XMLRec.Write(XMLFilename);
            }
            else
            {
                XMLRec.MustBeValidatable = true;
                XMLRec.Write(XMLFilename);
            }

            return(XMLFilename);
        }