* @param helper The helper that wraps the history document.
* @throws WorkflowException when something went wrong.
*/
protected void restoreState(WorkflowInstanceImpl instance, NamespaceHelper helper)
throws WorkflowException {
State state;
Element[] versionElements =
helper.getChildren(helper.getDocument().getDocumentElement(), VERSION_ELEMENT);
if (versionElements.length > 0) {
Element lastElement = versionElements[versionElements.length - 1];