public String execute() throws Exception {
    PatientAttribute patientAttribute = patientAttributeService.getPatientAttribute(id);

    patientAttribute.setName(name);
    patientAttribute.setDescription(description);
    patientAttribute.setValueType(valueType);
    patientAttribute.setExpression(expression);

    mandatory = (mandatory == null) ? false : true;
    patientAttribute.setMandatory(mandatory);

    inherit = (inherit == null) ? false : true;
    patientAttribute.setInherit(inherit);

    HttpServletRequest request = ServletActionContext.getRequest();

    Collection<PatientAttributeOption> attributeOptions =
        patientAttributeOptionService.get(patientAttribute);

    if (attributeOptions != null && attributeOptions.size() > 0) {
      String value = null;
      for (PatientAttributeOption option : attributeOptions) {
        value = request.getParameter(PREFIX_ATTRIBUTE_OPTION + option.getId());
        if (StringUtils.isNotBlank(value)) {
          option.setName(value.trim());
          patientAttributeOptionService.updatePatientAttributeOption(option);
          patientAttributeValueService.updatePatientAttributeValues(option);
        }
      }
    }

    if (attrOptions != null) {
      PatientAttributeOption opt = null;
      for (String optionName : attrOptions) {
        opt = patientAttributeOptionService.get(patientAttribute, optionName);
        if (opt == null) {
          opt = new PatientAttributeOption();
          opt.setName(optionName);
          opt.setPatientAttribute(patientAttribute);
          patientAttribute.addAttributeOptions(opt);
          patientAttributeOptionService.addPatientAttributeOption(opt);
        }
      }
    }

    patientAttributeService.updatePatientAttribute(patientAttribute);

    return SUCCESS;
  }