public function update($id = null, $attributes = [])
    {
        // Check the ID
        if (!isset($id)) {
            throw new \InvalidArgumentException('Undefined ID', 400);
        }

        // Set the attributes
        $attributes = (!empty($attributes))? $attributes : $this->app->request->input();

        // Update the record
        $result = $this->model->update($id, $attributes);

        // Return results
        return [
            'success' => true,
            'id' => $id,
            'data' => $result
        ];
    }