function duplicate()
 {
     $response = $this->get_response();
     $form = $response->form;
     if (!$form->get_errors() && $this->response->submit()) {
         $storage_id = $this->response->html->request()->get('storage_id');
         $storage = new storage();
         $resource = new resource();
         $deployment = new deployment();
         $storage->get_instance_by_id($storage_id);
         $resource->get_instance_by_id($storage->resource_id);
         $deployment->get_instance_by_id($storage->type);
         $name = $form->get_request('name');
         // check if volume / image name is aleady existing
         $image_check = new image();
         $image_check->get_instance_by_name($name);
         if (isset($image_check->id) && $image_check->id > 0) {
             $error = sprintf($this->lang['error_image_exists'], $name);
         }
         $linuxcoe_volume = new linuxcoe_volume();
         $linuxcoe_volume->get_instance_by_name($name);
         if (isset($linuxcoe_volume->id) && $linuxcoe_volume->id > 0) {
             $error = sprintf($this->lang['error_exists'], $name);
         }
         if (isset($error)) {
             $response->error = $error;
         } else {
             // add volume
             $linuxcoe_volume->get_instance_by_name($this->volume);
             $volume_fields = array();
             $volume_fields["linuxcoe_volume_id"] = (int) str_replace(".", "", str_pad(microtime(true), 15, "0"));
             $volume_fields['linuxcoe_volume_name'] = $name;
             $volume_fields['linuxcoe_volume_root'] = $linuxcoe_volume->root;
             $volume_fields['linuxcoe_volume_description'] = $linuxcoe_volume->description;
             $linuxcoe_volume->add($volume_fields);
             // add image
             $tables = $this->openqrm->get('table');
             $image_fields = array();
             $image_fields["image_id"] = (int) str_replace(".", "", str_pad(microtime(true), 15, "0"));
             $image_fields['image_name'] = $name;
             $image_fields['image_type'] = $deployment->type;
             $image_fields['image_rootfstype'] = 'local';
             $image_fields['image_storageid'] = $storage->id;
             $image_fields['image_comment'] = "Image Object for volume {$name}";
             $image_fields['image_rootdevice'] = 'local';
             $image = new image();
             $image->add($image_fields);
             $response->msg = sprintf($this->lang['msg_cloned'], $this->volume, $name);
             // save image id in response for the wizard
             $response->image_id = $image_fields["image_id"];
         }
     }
     return $response;
 }