public override void PostMigrate(string sourcePath, string destinationPath)
        {
            EnsureRfcTagsUnique(_migrationInfo);

            // Write them back, with their new file name.
            foreach (var migrationInfo in _migrationInfo)
            {
                var    writingSystemDefinitionV1 = _writingSystemsV1[migrationInfo.FileName];
                string sourceFilePath            = Path.Combine(sourcePath, migrationInfo.FileName);
                string destinationFilePath       = Path.Combine(destinationPath, migrationInfo.LanguageTagAfterMigration + ".ldml");
                if (migrationInfo.LanguageTagBeforeMigration != migrationInfo.LanguageTagAfterMigration)
                {
                    _auditLog.LogChange(migrationInfo.LanguageTagBeforeMigration, migrationInfo.LanguageTagAfterMigration);
                }
                WriteLdml(writingSystemDefinitionV1, sourceFilePath, destinationFilePath);
            }
            if (_migrationHandler != null)
            {
                _migrationHandler(ToVersion, _migrationInfo);
            }
        }
        public override void PostMigrate(string sourcePath, string destinationPath)
        {
            EnsureIeftLanguageTagsUnique(_migrationInfo);

            // Write them back, with their new file name.
            foreach (LdmlMigrationInfo migrationInfo in _migrationInfo)
            {
                Staging staging             = _staging[migrationInfo.FileName];
                string  sourceFilePath      = Path.Combine(sourcePath, migrationInfo.FileName);
                string  destinationFilePath = Path.Combine(destinationPath, migrationInfo.LanguageTagAfterMigration + ".ldml");

                XElement ldmlElem = XElement.Load(sourceFilePath);
                // Remove legacy palaso namespace from sourceFilePath
                ldmlElem.Elements("special").Where(e => !string.IsNullOrEmpty((string)e.Attribute(XNamespace.Xmlns + "palaso"))).Remove();
                ldmlElem.Elements("special").Where(e => !string.IsNullOrEmpty((string)e.Attribute(XNamespace.Xmlns + "palaso2"))).Remove();
                ldmlElem.Elements("special").Where(e => !string.IsNullOrEmpty((string)e.Attribute(XNamespace.Xmlns + "fw"))).Remove();

                // Remove collations to repopulate later
                ldmlElem.Elements("collations").Remove();

                // Write out the elements.
                XElement identityElem = ldmlElem.Element("identity");
                WriteIdentityElement(identityElem, staging, migrationInfo.LanguageTagAfterMigration);

                var layoutElement = ldmlElem.Element("layout");
                WriteLayoutElement(layoutElement);

                if (staging.CharacterSets.ContainsKey("main") || staging.CharacterSets.ContainsKey("punctuation"))
                {
                    XElement charactersElem = ldmlElem.GetOrCreateElement("characters");
                    WriteCharactersElement(charactersElem, staging);
                }

                if (staging.CharacterSets.ContainsKey("numeric"))
                {
                    XElement numbersElem = ldmlElem.GetOrCreateElement("numbers");
                    WriteNumbersElement(numbersElem, staging);
                }

                if (staging.SortUsing != WritingSystemDefinitionV1.SortRulesType.OtherLanguage)
                {
                    XElement collationsElem = ldmlElem.GetOrCreateElement("collations");
                    WriteCollationsElement(collationsElem, staging);
                }

                // If needed, create top level special for external resources
                if (!string.IsNullOrEmpty(staging.DefaultFontName))
                {
                    // Create special element
                    XElement specialElem = CreateSpecialElement(ldmlElem);
                    WriteTopLevelSpecialElements(specialElem, staging);
                }

                var writerSettings = CanonicalXmlSettings.CreateXmlWriterSettings();
                writerSettings.NewLineOnAttributes = false;
                using (var writer = XmlWriter.Create(destinationFilePath, writerSettings))
                    ldmlElem.WriteTo(writer);

                if (migrationInfo.LanguageTagBeforeMigration != migrationInfo.LanguageTagAfterMigration)
                {
                    _auditLog.LogChange(migrationInfo.LanguageTagBeforeMigration, migrationInfo.LanguageTagAfterMigration);
                }
            }
            if (_migrationHandler != null)
            {
                _migrationHandler(ToVersion, _migrationInfo);
            }
        }