/**
  * insert a metadata of file and move a file to sysytem's upload_dir
  *
  * @param XooNIpsOrmFile $file file to be inserted
  * @param bool $force force insertion flag
  * @return boolean false if failure
  */
 function insert(&$file, $force = false)
 {
     if (!$file->isDirty()) {
         // nothing to do
         return true;
     }
     // fill thumbnail field if empty
     if ($file->isNew()) {
         $thumbnail = $file->get('thumbnail_file');
         if (empty($thumbnail)) {
             $file_path = $file->getFilepath();
             $mimetype = $file->get('mime_type');
             $fileutil =& xoonips_getutility('file');
             $thumbnail = $fileutil->get_thumbnail($file_path, $mimetype);
             if (!empty($thumbnail)) {
                 $file->set('thumbnail_file', $thumbnail);
             }
         }
     }
     if (parent::insert($file, $force)) {
         if (!$file->isNew()) {
             // no need to move file if update
             return true;
         }
         if (!$file->get('is_deleted')) {
             // move file in the only case of not deleted file
             return $this->moveFile($file);
         } else {
             return true;
         }
     }
     return false;
 }