private void saveState() {

    Intent returnIntent = new Intent();
    ArrayList<DeviceConfiguration> motors = new ArrayList<>();
    if (motor1Enabled) {
      String name = motor1_name.getText().toString();
      MotorConfiguration newMotor = new MotorConfiguration(name);
      newMotor.setDisabled(false);
      newMotor.setPort(1);
      motors.add(newMotor);
    } else {
      motors.add(new MotorConfiguration(1));
    } // add disabled motor

    if (motor2Enabled) {
      String name = motor2_name.getText().toString();
      MotorConfiguration newMotor = new MotorConfiguration(name);
      newMotor.setDisabled(false);
      newMotor.setPort(2);
      motors.add(newMotor);
    } else {
      motors.add(new MotorConfiguration(2));
    } // add disabled motor

    motorControllerConfigurationConfig.addMotors(motors);
    motorControllerConfigurationConfig.setName(controller_name.getText().toString());
    returnIntent.putExtra(EDIT_MOTOR_CONTROLLER_CONFIG, motorControllerConfigurationConfig);

    setResult(RESULT_OK, returnIntent);
    finish();
  }
 private MotorControllerConfiguration m48a(
     SerialNumber serialNumber, String str, String str2, String str3) {
   MotorControllerConfiguration motorControllerConfiguration;
   if (serialNumber.equals(ControllerConfiguration.NO_SERIAL_NUMBER)) {
     motorControllerConfiguration = new MotorControllerConfiguration();
   } else {
     motorControllerConfiguration = (MotorControllerConfiguration) this.f101e.get(serialNumber);
   }
   motorControllerConfiguration.setName(str3);
   List arrayList = new ArrayList();
   MotorConfiguration motorConfiguration = new MotorConfiguration(1, str, true);
   MotorConfiguration motorConfiguration2 = new MotorConfiguration(2, str2, true);
   arrayList.add(motorConfiguration);
   arrayList.add(motorConfiguration2);
   motorControllerConfiguration.addMotors(arrayList);
   return motorControllerConfiguration;
 }