/**
  * @see parent::store()
  */
 function store()
 {
     if ($msg = $this->check()) {
         return $msg;
     }
     $new_object = !$this->_id;
     $now = CMbDT::dateTime();
     if ($new_object) {
         $this->group_id = CGroups::loadCurrent()->_id;
         $this->datetime_create = $now;
         $this->owner_id = CMediusers::get()->_id;
     }
     $this->datetime_edit = $now;
     if ($msg = parent::store()) {
         return $msg;
     }
     // Links
     if ($new_object) {
         $fields = array("object" => array("object_class", "object_id"), "ref1" => array("reference_class", "reference_id"), "ref2" => array("reference2_class", "reference2_id"), "add" => array("additional_class", "additional_id"));
         foreach ($fields as $_level => $_field) {
             if ($this->{$_field[0]} && $this->{$_field[1]}) {
                 $link = new CExLink();
                 $link->object_class = $this->{$_field[0]};
                 $link->object_id = $this->{$_field[1]};
                 $link->group_id = $this->group_id;
                 $link->ex_object_id = $this->_id;
                 $link->ex_class_id = $this->_ex_class_id;
                 $link->level = $_level;
                 if ($msg = $link->store()) {
                     return $msg;
                 }
             }
         }
     }
     return null;
 }