class ScenarioSimulationXMLPersistence {

    public String migrateIfNecessary(String rawXml) throws Exception {
        String fileVersion = extractVersion(rawXml);
        ThrowingConsumer<Document> migrator = getMigrationStrategy().start();
        boolean supported;
        switch (fileVersion) {
            case "1.0":
                migrator = migrator.andThen(getMigrationStrategy().from1_0to1_1());
            case "1.1":
                migrator = migrator.andThen(getMigrationStrategy().from1_1to1_2());
            case "1.2":
                migrator = migrator.andThen(getMigrationStrategy().from1_2to1_3());
            case "1.3":
                migrator = migrator.andThen(getMigrationStrategy().from1_3to1_4());
            case "1.4":
                migrator = migrator.andThen(getMigrationStrategy().from1_4to1_5());
            case "1.5":
                migrator = migrator.andThen(getMigrationStrategy().from1_5to1_6());
            case "1.6":
                migrator = migrator.andThen(getMigrationStrategy().from1_6to1_7());
            case "1.7":
                migrator = migrator.andThen(getMigrationStrategy().from1_7to1_8());
                supported = true;
                break;
            default:
                supported = CURRENT_VERSION.equals(fileVersion);
                break;
        }
        if (!supported) {
            throw new IllegalArgumentException(new StringBuilder().append("Version ").append(fileVersion)
                                                       .append(" of the file is not supported. Current version is ")
                                                       .append(CURRENT_VERSION).toString());
        }
        migrator = migrator.andThen(getMigrationStrategy().end());
        Document document = DOMParserUtil.getDocument(rawXml);
        migrator.accept(document);
        return DOMParserUtil.getString(document);
    }

    private  ScenarioSimulationXMLPersistence();

}