if(!model.isEmpty()) {
writer.write(",data_source: [");
for(Iterator<Timeline> it = model.iterator(); it.hasNext();) {
Timeline timeline = it.next();
String id = timeline.getId();
writer.write("{");
writer.write("\"id\":\"" + timeline.getId() + "\"");
writer.write(",\"title\":\"" + timeline.getTitle() + "\"");
writer.write(",\"initial_zoom\":\"" + timeline.getInitialZoom() + "\"");
writer.write(",\"focus_date\":\"" + formatter.format(timeline.getFocusDate()) + "\"");
//events
writer.write(",\"events\":[");
for(Iterator<TimelineEvent> eventIter = timeline.getEvents().iterator(); eventIter.hasNext();) {
encodeEvent(context, eventIter.next(), formatter, id);
if(eventIter.hasNext()) {
writer.write(",");
}