protected function prepareEditorTpl($id = null)
    {
        $mode = $id === null ? 'create' : 'edit';
        /** @var \Colibri\Database\Model $item */
        $item = new $this->itemClass();

        // if must save any changes
        if ($_POST) {
            $this->save($id, $item);

            return;
        }

        $this->loadTemplate($mode);

        if ($mode == 'edit') {
            $item->load($id);
        }

        $this->initItem($item, $id);

        if ($_POST) { // if post data not valid ($_POST && isset($this->template->vars['errors']))
            $this->fillWithUserValues($item);
        }

        $this->template->vars['mode']            = $mode;
        $this->template->vars[$this->itemTplVar] = $item;
    }