public void executeAction(ActionEvent event) {
    if (mode.equals(Constant.SCHEDULE_REMOVE)) {
      for (ScheduleBranch row : listScheduleBranch) {
        if (row.getState() == 1) {
          tableService.removeSchedule(
              row.getCrmDoctorSchedule().getCrmBranch().getId(),
              row.getCrmDoctorSchedule().getCrmDoctor().getId());
        }
      }
    }

    int count = 0;
    for (ScheduleBranch row : listScheduleBranch) {
      if (row.getState() == 1) {
        String message = FacesUtil.getMessage("msg_record_ok");
        row.setMessage(message);
        tableService.saveDoctorSchedule(row.getCrmDoctorSchedule());
        count++;
      }
    }

    disabledButton = true;
    disabledExecuteButton = true;
    String message = FacesUtil.getMessage("msg_load_ok", String.valueOf(count));
    FacesUtil.addInfo(message);
  }
  public void saveAction() {
    String message = null;

    int result = tablesService.saveProfile(selected);
    if (result == 0) {
      list = tablesService.getListProfile();
      model = new ProfileDataModel(list);
      message = FacesUtil.getMessage("msg_record_ok");
      FacesUtil.addInfo(message);
    } else if (result == -1) {
      String paramValue = FacesUtil.getMessage("pro_code");
      message = FacesUtil.getMessage("msg_record_unique_exception", paramValue);
      FacesUtil.addError(message);
    }
  }
  public ProfileDataModel getModel() {
    if (model == null) {
      list = tablesService.getListProfile();
      model = new ProfileDataModel(list);

      if (list.size() > 0) {
        selected = list.get(0);
      }
    }
    return model;
  }