/**
  * @param            $versionName
  * @param bool|false $all
  *
  * @throws MigrationException
  */
 protected function mark($versionName, $all = false)
 {
     if (!$this->configuration->hasVersion($versionName)) {
         throw MigrationException::unknownMigrationVersion($versionName);
     }
     $version = $this->configuration->getVersion($versionName);
     if ($this->markMigrated && $this->configuration->hasVersionMigrated($version)) {
         $marked = true;
         if (!$all) {
             throw new InvalidArgumentException(sprintf('The version "%s" already exists in the version table.', $version));
         }
     }
     if (!$this->markMigrated && !$this->configuration->hasVersionMigrated($version)) {
         $marked = false;
         if (!$all) {
             throw new InvalidArgumentException(sprintf('The version "%s" does not exists in the version table.', $version));
         }
     }
     if (!isset($marked)) {
         $filename = $this->configuration->getNamingStrategy()->getFilename($versionName);
         if ($this->markMigrated) {
             $version->markMigrated();
             $this->info('<info>Added version to table:</info> ' . $filename);
         } else {
             $version->markNotMigrated();
             $this->info('<info>Removed version from table:</info> ' . $filename);
         }
     }
 }