if (federationNodeRef == null) {
// there isn't a federation node present, so we need to add it
try {
Property primaryType = propertyFactory.create(JcrLexicon.PRIMARY_TYPE, ModeShapeLexicon.FEDERATION);
systemNode.createChild(systemSession, systemNodeKey.withId("mode:federation"), ModeShapeLexicon.FEDERATION,
primaryType);
systemSession.save();
federationNodeRef = systemNode.getChildReferences(systemSession).getChild(ModeShapeLexicon.FEDERATION);
} catch (Exception e) {
throw new RuntimeException(e);