public function updateAction($id)
    {
        $this->initializeScaffolding();
        $this->checkRequest();

        try {
            $this->beforeRead();
            $this->view->record = $this->scaffolding->doRead($id);
            $this->afterRead();

            $this->beforeUpdate();
            $this->scaffolding->doUpdate($id, $this->request->getPost());
            $this->flash->success($this->successMessage);
            return $this->afterUpdate();
        } catch (Exception $e) {
            $this->flash->error($e->getMessage());
            $this->afterUpdateException();
        }

        return $this->dispatcher->forward(['action' => 'edit']);
    }