public function editInstance()
    {
        $this->defaultData();

        $clazz = $this->getCurrentClass();
        $instance = $this->getCurrentInstance();
        $myFormContainer = new editInstanceForm($clazz, $instance);

        $myForm = $myFormContainer->getForm();
        if ($myForm->isSubmited()) {
            if ($myForm->isValid()) {

                $values = $myForm->getValues();
                // save properties
                $binder = new \tao_models_classes_dataBinding_GenerisFormDataBinder($instance);
                $instance = $binder->bind($values);
                $message = __('Instance saved');

                $this->setData('message', $message);
                $this->setData('reload', true);
            }
        }

        $this->setData('formTitle', __('Edit Instance'));
        $this->setData('myForm', $myForm->render());
        $uri = ($this->hasRequestParameter('id')) ? $this->getRequestParameter('id') : $this->getRequestParameter('uri');

        try {
            $mediaSource = new MediaSource(array());
            $fileInfo = $mediaSource->getFileInfo($uri);

            $mimeType = $fileInfo['mime'];
            $xml = in_array($mimeType, array('application/xml', 'text/xml'));
            $url = \tao_helpers_Uri::url(
                'getFile',
                'MediaManager',
                'taoMediaManager',
                array(
                    'uri' => $uri,
                )
            );
            $this->setData('xml', $xml);
            $this->setData('fileurl', $url);
            $this->setData('mimeType', $mimeType);

        } catch (\tao_models_classes_FileNotFoundException $e) {
            $this->setData('error', __('No file found for this media'));
        }
        $this->setView('form.tpl');

    }