private function ClearInstalledBundles()
    {
        //Clear bundles without code folder
        $bundles = PathUtil::Bundles();
        $sql = new Sql\Builder($this->connection);
        $inList = $sql->InListFromValues($bundles);
        $tbl = InstalledBundle::Schema()->Table();
        
        $where = $sql->NotIn($tbl->Field('Bundle'), $inList);
        InstalledBundle::Schema()->Delete($where);
        //Clear failed bundles
        $failedList = $sql->InListFromValues(array_keys($this->failedBundles));
        if ($failedList)
        {
            InstalledBundle::Schema()->Delete($sql->In($tbl->Field('Bundle'), $failedList));
        }
    }