                                   (assoc expanded-url :url (:expanded_url %)))) record-urls))
         articles (if (nil? expanded-urls)
                    nil
-                   (map #(assoc % :article (-> (mc/find-one-as-map (:db @mongo-state) "articles" {:url (:url %)}) :_id)) expanded-urls))]
+                   (map #(assoc % :article (-> (mc/find-one-as-map (:db @mongo-state) "articles" {:url (:url %)}) :_id)) expanded-urls))
+        ancestors (trace-parent record [])]
     (if (nil? articles)
-      nil
+      (store-origin (assoc % :record oid :ts ts :source source :ancestors ancestors))
       (doall
        (map
         #(if (:article %)
-           (do (store-url (assoc % :record oid :ts ts :source source))
+           (do (store-origin (assoc % :record oid :ts ts :source source :ancestors ancestors))
                (update-in (mc/find-map-by-id (:db @mongo-state) "articles" (:article %)) [:ts] (fn [x] (f/unparse (:custom-formatter @mongo-state) x))))
            (let [article (store-article (assoc % :ts ts))]
-             (do (store-url (assoc % :article (:_id article) :record oid :ts ts :source source))
+             (do (store-origin (assoc % :article (:_id article) :record oid :ts ts :source source :ancestors ancestors))
                  (do (store-url (assoc % :record oid :ts ts :source source))
                      (update-in article [:ts] (fn [x] (f/unparse (:custom-formatter @mongo-state) x)))))))
         articles)))))

                                    :content-type content-type})))))))


(defn store-url [{:keys [article record ts source]}]
  (mc/insert-and-return
   (:db @mongo-state)

       clojure.pprint/pprint)


  (->> (mc/find-maps (:db @mongo-state) "urls" {:article (first sz-url)})
       (mapv #(assoc % :tweet  (mc/find-map-by-id (:db @mongo-state) "tweets" (:tweet %) [:in_reply_to_status_id_str :text :user.screen_name :retweeted :id_str])))
       clojure.pprint/pprint)

  (def spon-url (->> (mc/find-maps (:db @mongo-state) "articles" {:ts {$gt (t/date-time 2014 7 27)}} [:title])
                  (map #(vec [(:_id %) (:title %) (first (find-source (:_id %)))]))
                  (remove #(empty? (last %)))
                  (filter #(= "SPIEGELONLINE" (-> % last :source)))
