public function set_preferences($id_user, $id_file, $md5, array $cfg = null, bbn\user\preferences $pref = null){
    if ( !empty($id_user) && !empty($id_file) && !empty($pref) ){
      $change['md5'] = $md5;
      if ( !empty($cfg['selections']) ){
        $change['selections'] = $cfg['selections'];
      }
      if ( isset($cfg, $cfg['marks']) ){
        $change['marks'] = $cfg['marks'];
      }
      if ( !empty($change) ){
        $id_option = $this->option_id($id_file);
        if ( $pref->set($id_option, $change, $id_user) ){
          return true;
        }
      }
    }
    return false;
  }