private <T extends Event> T convertConfig(Event theInitialConfig, Class<T> theDesiredClass) {
    if (theInitialConfig.getClass().equals(theDesiredClass)) {
      return (T) theInitialConfig;
    }

    StringWriter stringWriter = new StringWriter();
    JAXB.marshal(theInitialConfig, stringWriter);

    return JAXB.unmarshal(new StringReader(stringWriter.toString()), theDesiredClass);
  }
  /**
   * Creates a new default event, typically in response to a user clicking an "add event" button.
   * The user could then modify the type of event to suit their purposes.
   */
  public AbstractEvent createDefaultEvent(TestBatteryImpl theBattery, TestImpl theTest)
      throws ConfigurationException {

    if (theBattery.getInterfaces().isEmpty()) {
      throw new ConfigurationException(
          "Can't create event because no interfaces have been defined");
    }

    AbstractInterface iface = theBattery.getInterfaces().get(0);
    myDefaultEventConfig.setInterfaceId(iface.getId());

    // TODO: create blank event type for use here
    return createEvent(myDefaultEventClass, theTest, myDefaultEventConfig);
  }