'use strict';
/*
 *
 */
angular.module('arethusa').factory('TreebankPersister', [
  'documentStore',
  'configurator',
  function (documentStore, configurator) {
    return function() {
    };
  }
]);


@@ -112,16 +112,31 @@
 rator',%0A
+  'navigator',%0A
   functi
@@ -166,16 +166,27 @@
 igurator
+, navigator
 ) %7B%0A    
@@ -201,19 +201,1252 @@
 unction(
-) %7B
+conf) %7B%0A      var resource = configurator.provideResource(conf.resource);%0A%0A      function updateXml() %7B%0A        var doc = documentStore.store.tbd; // placeholder%0A        doc.xml = arethusaUtil.json2xml(doc.json);%0A      %7D%0A%0A      function updateDocument() %7B%0A        var doc = documentStore.store.tbd; // placeholder%0A        var stored = arethusaUtil.toAry(doc.json.treebank.sentence);%0A        // navigator has to provide means to retrieve sentences by id%0A        // and not only through a flat array!%0A        var sentences = navigator.sentences;%0A%0A        angular.forEach(stored, function(sentence, i) %7B%0A          var updated = sentences%5Bsentence._id - 1%5D;%0A          angular.forEach(sentence.word, function(word, i) %7B%0A            var stateWord = updated.tokens%5BarethusaUtil.formatNumber(word._id, 4)%5D;%0A%0A            word._head = arethusaUtil.formatNumber(stateWord.head.id, 0);%0A            word._relation = stateWord.relation.label;%0A            word._lemma = stateWord.morphology.lemma;%0A            word._postag = stateWord.morphology.postag;%0A            word._form = stateWord.string;%0A          %7D);%0A        %7D);%0A      %7D%0A%0A      this.saveData = function(callback) %7B%0A        updateDocument();%0A        updateXml();%0A%0A        callback();%0A      %7D;
 %0A    %7D;%0A

Add update fns to TreebankPersister