While this can work here because I think the client_id & template are not going to be changed we should use always the data received if there is.

What you are doing here is to use only the id from the data and then load the old item information from the DB. That means that if id the client_id or the template have been changed those changes won't be applied.

```php
$item = empty($data) ? $this->getItem() : $this->getItem($data['id']);
$clientId  = isset($data['client_id']) ? $data['client_id'] : $item->client_id;
$template  = isset($data['template']) ? $data['template'] : $item->template;
```