protected function onBeforeWrite() {
        parent::onBeforeWrite();
        
        if($this->ID==0) {
            $this->CreatorID=Member::currentUserID();
        }else {
            $this->LastEditorID=Member::currentUserID();
            
            //If the language is changing reset the folder id
            if($this->isChanged('LanguageID')) {
                $this->FolderID=0;
            }
        }
    }