public function markAsMigrated($version, $markAsMigrated)
    {
        $configuration = $this->getMigrationConfiguration();

        if ($version === 'all') {
            foreach ($configuration->getMigrations() as $version) {
                if ($markAsMigrated === true && $configuration->hasVersionMigrated($version) === false) {
                    $version->markMigrated();
                } elseif ($markAsMigrated === false && $configuration->hasVersionMigrated($version) === true) {
                    $version->markNotMigrated();
                }
            }
        } else {
            if ($configuration->hasVersion($version) === false) {
                throw MigrationException::unknownMigrationVersion($version);
            }

            $version = $configuration->getVersion($version);

            if ($markAsMigrated === true) {
                if ($configuration->hasVersionMigrated($version) === true) {
                    throw new MigrationException(sprintf('The version "%s" is already marked as executed.', $version));
                }
                $version->markMigrated();
            } else {
                if ($configuration->hasVersionMigrated($version) === false) {
                    throw new MigrationException(sprintf('The version "%s" is already marked as not executed.', $version));
                }
                $version->markNotMigrated();
            }
        }
    }