GUI2 ModelCache bug fix for NPE

Change-Id: Ib5bf3c879c7c980a7fb8e3c11af68867be3431c0
diff --git a/web/gui/src/main/java/org/onosproject/ui/impl/topo/model/ModelCache.java b/web/gui/src/main/java/org/onosproject/ui/impl/topo/model/ModelCache.java
index 1efa2e4..4cb30e0 100644
--- a/web/gui/src/main/java/org/onosproject/ui/impl/topo/model/ModelCache.java
+++ b/web/gui/src/main/java/org/onosproject/ui/impl/topo/model/ModelCache.java
@@ -192,12 +192,7 @@
         //  or can we rely on looking it up live?
         // TODO: store the updated mastership information
         UiDevice uiDevice = uiTopology.findDevice(deviceId);
-        ObjectNode data = t2json != null ? t2json.jsonUiElement(uiDevice) : null;
-        String oldMaster = data.get("master").asText();
-        NodeId newMaster = roleInfo.master();
-        data.put("master", newMaster.toString());
-        log.debug("Changed master of {} to {} (was {})", deviceId, newMaster.toString(), oldMaster);
-        dispatcher.post(new UiModelEvent(DEVICE_ADDED_OR_UPDATED, uiDevice, data, MEMO_UPDATED));
+        postEvent(DEVICE_ADDED_OR_UPDATED, uiDevice, MEMO_UPDATED);
     }
 
     // === THE NULL REGION