// added:
  public Election convert() throws DatatypeConfigurationException {
    Election el = new Election();
    el.setId(this.getId().toString());
    el.setPrivateKey(this.getPrivateKey());
    el.setPublicKey(this.getPublicKey());
    el.setTitle(this.getTitle());
    el.setQuestion(this.getQuestion());
    el.setUrl(this.getUrl());

    GregorianCalendar c = new GregorianCalendar();
    c.setTime(this.getValidFrom());
    el.setValidFrom(DatatypeFactory.newInstance().newXMLGregorianCalendar(c));
    c.setTime(this.getValidTo());
    el.setValidTo(DatatypeFactory.newInstance().newXMLGregorianCalendar(c));

    for (int i = 0; i < this.choice.size(); i++) {
      el.getChoice().add(choice.get(i).convert());
    }
    return el;
  }