Persist Generation from angularjs service