@Override
  protected void onMenuSave() {
    log.debug("name: {}", editTextEnergyName.getText());
    log.debug("where: {}", editTextEnergyWhere.getText());
    log.debug("version: {}", getSelectedEnergyVersion());
    log.debug("environment: {}", getSelectedEnvironment());
    log.debug("gateway: {}", getSelectedGateway());
    log.debug("favourite: {}", isFavourite());

    if (isValidEnergy()) {
      if (energyUuid == null) {
        energyService.add(parseEnergy()).subscribe(uuid -> finish());
      } else {
        energyService.update(parseEnergy()).doOnCompleted(this::finish).subscribe();
      }
    }
  }
  private void initEditEnergy() {
    energyUuid = getIntent().getStringExtra(RealmModel.FIELD_UUID);
    log.debug("initEditEnergy: {}", energyUuid);
    if (energyUuid != null) {
      energyService
          .findById(energyUuid)
          .subscribe(
              energy -> {
                editTextEnergyName.setText(String.valueOf(energy.getName()));
                editTextEnergyWhere.setText(String.valueOf(energy.getWhere()));

                selectEnergyVersion(energy.getEnergyManagementVersion());
                selectEnvironment(energy.getEnvironmentId());
                selectGateway(energy.getGatewayUuid());
                setFavourite(energy.isFavourite());
              });
    }
  }