public function save() { $religionId = $this->getValue('religionId'); if (!empty($religionId)) { $religion = $this->getReligionService()->getReligionById($religionId); } else { $religion = new Religion(); } $religion->setCode($this->getValue('code')); $religion->setName($this->getValue('name')); $religion->save(); }