public function deleteInstances($selfedit = "false", $instancesNames = array(), $returnurl = null) {
        $this->selfedit = $selfedit;

        if ($selfedit == "true") {
            $this->moufManager = MoufManager::getMoufManager();
        } else {
            $this->moufManager = MoufManager::getMoufManagerHiddenInstance();
        }

        if(!empty($instancesNames)) {
            foreach($instancesNames as $instanceName) {
                $this->moufManager->removeComponent($instanceName);
            }
            $this->moufManager->rewriteMouf();
        }

        if ($returnurl) {
            header("Location:".$returnurl);
        } else {
            header("Location: .?selfedit=".$selfedit);
        }
    }