private function SortFilesByVersion(array $files)
    {
        $result = array();
        $foreignKeysFile = '';
        foreach ($files as $file)
        {
            if ($file == 'foreign-keys.sql')
            {
                $foreignKeysFile = $file;
                continue;
            }
            $version = Path::RemoveExtension($file);
            if ($this->installedVersion && version_compare($version, $this->installedVersion) <= 0)
            {
                continue;
            }
            $result[$version] = $file;
        }
        uksort($result, "version_compare");
        if ($foreignKeysFile)
        {
            $result[] = $foreignKeysFile;
        }
        return $result;
    }