public void replicateToMongoDB(CityTraverser tasks) {
    List<City> cities = tasks.getWorkflowHelperWrapper().getAllEntities();

    for (City city : cities) {
      MongoCity mongoCity = new MongoCity();

      mongoCity.setName(city.getName());
      mongoCity.setId(city.getPk());

      MongoState state = stateMongoDao.find(city.getState().getPk());
      MongoCountry country = countryMongoDao.find(city.getCountry().getPk());

      mongoCity.setState(state);
      mongoCity.setCountry(country);

      mongoCity.setId(city.getPk());

      cityMongoDao.merge(mongoCity);
    }
  }
  public void replicateToMongoDB(StateTraverser tasks) {
    List<State> states = tasks.getWorkflowHelperWrapper().getAllEntities();

    for (State state : states) {
      MongoState mongoState = new MongoState();

      mongoState.setName(state.getName());
      mongoState.setId(state.getPk());

      MongoCountry country = countryMongoDao.find(state.getCountry().getPk());

      mongoState.setCountry(country);

      mongoState.setId(state.getPk());

      stateMongoDao.merge(mongoState);
    }
  }