     :article article
     :source source
     :ancestors ancestors
+    :root root
     :ts ts}))
 
 

        ancestors (trace-parent record [])]
    (if (nil? articles)
      (do
        (store-origin (assoc % :record oid :ts ts :source source :ancestors ancestors))
        nil)
      (doall
       (map
        #(if (:article %)
           (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-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)))))

    :ts ts}))


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