public function registerMigration($version, $class)
    {
        $version = (string) $version;
        $class = (string) $class;
        if (isset($this->migrations[$version])) {
            $message = sprintf(
                'Migration version %s already registered with class %s',
                $version,
                get_class($this->migrations[$version])
            );
            throw new DuplicateVersionException($message);
        }
        $version = new Version($this, $version, $class);
        $this->migrations[$version->getVersion()] = $version;
        ksort($this->migrations);

        return $version;
    }