class DashboardTabPaneSaver implements ElementTypeAdapter<DashboardTabPane> {

  @Override
  public DashboardTabPane deserialize(JsonElement json, JsonDeserializationContext context) throws JsonParseException {
    JsonArray jsonTabs = json.getAsJsonArray();
    List<Tab> tabs = new ArrayList<>(jsonTabs.size());

    for (JsonElement i : jsonTabs) {
      JsonObject obj = i.getAsJsonObject();
      String title = obj.get("title").getAsString();
      DashboardTab tab = new DashboardTab(title);
      tab.setWidgetPane(context.deserialize(obj.get("widgetPane"), WidgetPane.class));
      tab.setSourcePrefix(obj.get("autoPopulatePrefix").getAsString());
      tab.setAutoPopulate(obj.get("autoPopulate").getAsBoolean());
      tabs.add(tab);
    }

    return new DashboardTabPane(tabs.toArray(new Tab[]{}));
  }

}