I need to generate a unique value for a column. I want to increment the last inserted value in the table. 

I've tried this, but to no avail

```
if($this->request->is('post')){
    $code = $this->Department->find('first', array(
        'fields' => 'Department.code',
        'order'  => 'Department.code DESC'
    ));
    $code += 1;
    $this->data['Department']['code'] = $code;
    if($this->Department->save($this->request->data)){
        $this->Session->setFlash('New department added.');
        $this->redirect(array('action' => 'add'));
    }
}

```

Thanks!