public function put_post($data)
    {
        $m = $this->model;

        if ($m->loaded()) {
            if (!$this->allow_edit) {
                throw $this->exception('Editing is not allowed');
            }
            $data = $this->_input($data, $this->allow_edit);
        } else {
            if (!$this->allow_add) {
                throw $this->exception('Adding is not allowed');
            }
            $data = $this->_input($data, $this->allow_add);
        }

        return $this->outputOne($m->set($data)->save()->get());
    }