/**
  * @param AccountType $accountType
  * @return AccountType
  */
 public function saveAccountType(AccountType $accountType)
 {
     $id = $accountType->getAccountTypeId();
     $data = $accountType->getArrayCopy();
     if ($id > 0) {
         $this->update($data, array('accountTypeId' => $id));
     } else {
         unset($data['accountTypeId']);
         $this->insert($data);
     }
     if (!$accountType->getAccountTypeId()) {
         $accountType->setAccountTypeId($this->getLastInsertValue());
     }
     return $accountType;
 }