public function createAudit($type, ModelInterface $model)
{
//Get the session service
$session = $model->getDI()->getSession();
//Get the request service
$request = $model->getDI()->getRequest();
$audit = new Audit();
//Get the username from session
$audit->user_name = $session->get('userName');
//The model who performed the action
$audit->model_name = get_class($model);
//The client IP address
$audit->ipaddress = $request->getClientAddress();
//Action is an update
$audit->type = $type;
//Current time
$audit->created_at = date('Y-m-d H:i:s');
return $audit;
}