/**
  * Add Client Investment Process
  */
 public function processAddClientInvestmentAction()
 {
     if (!$this->_request->isXmlHttpRequest() || !$this->_request->isPost()) {
         $this->_redirector->gotoRoute(array('controller' => 'index', 'module' => 'clients'), 'admin');
     }
     $return = array();
     $clientInvestmentGateway = new Clients_Model_ClientInvestmentGateway();
     $form = $clientInvestmentGateway->getForm('CreateClientInvestment');
     $validForm = $form->isValid($this->_request->getParams());
     // Check the form for validity
     if (!$validForm) {
         $return['formErrors'] = $form->getMessages();
     } else {
         $clientInvestment = $clientInvestmentGateway->create($form->getValues());
         $clientInvestmentId = $clientInvestment->save();
         $clientInvestment = $clientInvestmentGateway->fetchClientInvestment($clientInvestmentId);
         if (is_object($clientInvestment)) {
             $clientInvestment = $clientInvestment->toArray();
         }
         $flashMessenger = $this->_helper->getHelper('FlashMessenger');
         $flashMessenger->setNamespace('notifications')->addMessage('Client Investment Added');
         $return = array('append' => array('target' => '#clientInvestment', 'content' => $this->view->partial('partials/_clientInvestmentRow.phtml', 'clients', $clientInvestment)), 'refresh' => true);
         $return['callback'] = '$("#add-investment-dialog").dialog("close");';
     }
     $this->_helper->json->sendJson($return);
 }