public function saveAction()
 {
     if ($data = $this->getRequest()->getPost()) {
         $this->_getSession()->setFormData($data);
         $model = Mage::getModel('ecodes/premiumsubs');
         $id = (int) $this->getRequest()->getParam('id');
         $session = $this->_getSession();
         try {
             //print_r($data); die;
             if ($id) {
                 $model->load($id);
             }
             if (!empty($data['new_pass'])) {
                 $helper_core = Model::helper('core');
                 $helper_ecodes = Mage::helper('ecodes');
                 $validation_error = $helper_ecodes->validate($data['new_pass'], $data['user'], $data['firstname'], $data['lastname']);
                 if ($validation_error) {
                     $session->addError($validation_error);
                     $this->_redirect('*/*/edit', array('id', $id));
                     exit;
                     // ensure no further processing
                 }
                 $enc_pass = $helper->encrypt($data['new_pass']);
                 $data['pass'] = $enc_pass;
             }
             $model->addData($data);
             $model->save();
             $this->_getSession()->addSuccess($this->__('PremiumACCESS Subscription was successfully saved.'));
             $this->_getSession()->setFormData(false);
             //if($this->getRequest()->getParam('back')) { // save and continue button check
             $customer = Mage::getModel('customer/customer')->load($model->getCustomerId());
             $params = array('id' => $customer->getId());
             $this->_redirect('*/customer/edit', $params);
             //} else {
             //    $this->_redirect('*/*/list');
             //}
         } catch (Exception $e) {
             $this->_getSession()->addError($e->getMessage());
             if ($model && $model->getId()) {
                 $this->_redirect('*/*/edit', array('id' => $model->getId()));
             } else {
                 $this->_redirect('*/customer');
             }
         }
         return;
     }
     // end if the request object has data to return to us
     // if there is no data
     $this->_getSession()->addError($this->__('No data found to save'));
     $this->_redirect('*/customer');
     // forward to the controller index action
 }