private static TenantAuthenticationCollection OpenAndRead(string fileName)
        {
            TenantAuthenticationCollection tenants = new TenantAuthenticationCollection();

            try
            {
                if (!string.IsNullOrEmpty(fileName) && System.IO.File.Exists(fileName))
                {
                    // Create the serializer
                    var serializer = new XmlSerializer(typeof(TenantAuthenticationCollection));

                    // Open config file
                    using (var stream = new System.IO.StreamReader(fileName))
                    {
                        // De-serialize the XML
                        tenants = serializer.Deserialize(stream) as TenantAuthenticationCollection;
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Can't read the configuration, 'Recent Tenants' is empty.", ex);
            }

            return(tenants);
        }
        private static void Write(string fileName, TenantAuthenticationCollection tenants)
        {
            if (!string.IsNullOrEmpty(fileName))
            {
                // Create the serializer
                var serializer = new XmlSerializer(typeof(TenantAuthenticationCollection));

                // Open config file
                using (var stream = new System.IO.StreamWriter(fileName))
                {
                    // Serialize the XML
                    serializer.Serialize(stream, tenants);
                }
            }
        }