                  MERGE (e:Event {id: {event}.id})
                  SET e = {event}
                  MERGE (g)-[:HOSTED_EVENT]->(e)
+                 WITH e, g
+                 MATCH (year:Year {year: {timetree}.year })
+                 MATCH (year)-[:HAS_MONTH]->(month {month: {timetree}.month })
+                 MATCH (month)-[:HAS_DAY]->(day {day: {timetree}.day })
+                 CREATE (m)-[:JOINED_ON]->(day) 
                  MERGE (v:Venue {id: {venue}.id})
                  SET v = {venue}
                  MERGE (e)-[:HELD_AT]->(v)
                  RETURN ID(g)"
                 {:group (:group event)
                  :venue (:venue event)
+                 :timetree (as-timetree (:time event))              
                  :event { :id (:id event)
                          :name (:name event)
                          :description (:description event)

  (:require [clj-http.client :as client])
  (:require [clojure.data.json :as json])
  (:require [environ.core :as e])
  (:require [clojurewerkz.neocons.rest :as nr]
            [clojurewerkz.neocons.rest.transaction :as tx]))


       (filter #(= (str event-id) (->> % :event :id)))
       (filter #(not (= (:created %) (:mtime %))))))

(defn load-into-neo4j []
  (create-time-tree 2011 2014)
  (tx-api create-member  (load "data/members-2014-04-22.json"))
  (tx-api create-event  (load "data/events-2014-04-22.json"))
  (tx-api create-rsvp (rsvps-with-responses (load "data/rsvps-2014-04-22.json"))))

(defn main []
  (save "data/members-2014-04-22.json" (get-all members))
  (save "data/events-2014-04-22.json" (get-all events))
  (save "data/rsvps-2014-04-22.json"
        (mapcat #(get-all (partial rsvps %)) (map :id (load "data/events-2014-04-22.json")))))
