/**
  * Add Client Asset Process
  */
 public function processAddClientAssetAction()
 {
     if (!$this->_request->isXmlHttpRequest() || !$this->_request->isPost()) {
         $this->_redirector->gotoRoute(array('controller' => 'index', 'module' => 'clients'), 'admin');
     }
     $return = array();
     $clientAssetGateway = new Clients_Model_ClientAssetGateway();
     $form = $clientAssetGateway->getForm('CreateClientAsset');
     $validForm = $form->isValid($this->_request->getParams());
     // Check the form for validity
     if (!$validForm) {
         $return['formErrors'] = $form->getMessages();
     } else {
         $formData = $form->getValues();
         //set correct date format for Pay Off Date
         $formData['client_asset_payoffdate'] = $this->_dateFormatter->saveDateFormat($formData['client_asset_payoffdate'], $formData['altPayoffDate']);
         unset($formData['altPayoffDate']);
         $clientAsset = $clientAssetGateway->create($formData);
         $clientAssetId = $clientAsset->save();
         $clientAsset = $clientAssetGateway->fetchClientAsset($clientAssetId);
         if (is_object($clientAsset)) {
             $clientAsset = $clientAsset->toArray();
         }
         $clientAsset['client_asset_payoffdate'] = $this->_dateFormatter->viewDateFormat($clientAsset['client_asset_payoffdate']);
         $flashMessenger = $this->_helper->getHelper('FlashMessenger');
         $flashMessenger->setNamespace('notifications')->addMessage('Client Asset Added');
         $return = array('append' => array('target' => '#clientAsset', 'content' => $this->view->partial('partials/_clientAssetRow.phtml', 'clients', $clientAsset)), 'refresh' => true);
         $return['callback'] = '$("#add-asset-dialog").dialog("close");';
     }
     $this->_helper->json->sendJson($return);
 }