public void save(String storeBasePath) throws Exception {

    PersistenceManager persistenceManager = getContext().getPersistenceManager();

    if (persistenceManager == null) throw new NullPointerException("Persistence manager not set");

    PersistedFormDocument formDocument = persistenceManager.saveForm(this, storeBasePath);
    setFormType(formDocument.getFormType());
    setFormId(formDocument.getFormId());
  }
  public void saveAllVersions(Long parentId) throws Exception {

    PersistenceManager persistenceManager = getContext().getPersistenceManager();

    if (persistenceManager == null) throw new NullPointerException("Persistence manager not set");

    PersistedFormDocument formDocument = persistenceManager.saveAllVersions(this, parentId);
    setFormType(formDocument.getFormType());
    setFormId(formDocument.getFormId());
  }