/// <summary>
        /// Serializes the entity collection to xml and puts the data into a file.
        /// </summary>
        /// <param name="entityCollection">The Entity collection to serialize.</param>
        /// <param name="path">The Path to the destination file.</param>
        public static void SerializeXml <T>(TList <T> entityCollection, string path) where T : IEntity, new()
        {
            XmlSerializer ser = new XmlSerializer(entityCollection.GetType());
            StreamWriter  sw  = new StreamWriter(path);

            ser.Serialize(sw, entityCollection);
            sw.Close();
        }
        /// <summary>
        /// Serializes the <see cref="T:TList{T}"/> of IEntity to XML
        /// </summary>
        /// <typeparam name="T">type to return, type must implement IEntity</typeparam>
        /// <param name="entityCollection">TList of T type to return</param>
        /// <returns>string of serialized XML</returns>
        public static string SerializeXml <T>(TList <T> entityCollection)  where T : IEntity, new()
        {
            XmlSerializer ser    = new XmlSerializer(entityCollection.GetType());
            StringBuilder sb     = new StringBuilder();
            TextWriter    writer = new StringWriter(sb);

            ser.Serialize(writer, entityCollection);
            writer.Close();
            return(sb.ToString());
        }