                      (map #(http/json-get (:id %)))
                      (remove #(nil? ((keyword "@language") %))))
         default-language (get badge (keyword "@language") "")
-        endorsement (cond
-                      (map? (:endorsement assertion)) [{:id nil
-                                                        :external_id (get-in assertion [:endorsement :id])
-                                                        :user_badge_id nil
-                                                        :issuer_id nil
-                                                        :issuer_name (get-in assertion [:endorsement :issuer :name])
-                                                        :issuer_url (get-in assertion [:endorsement :issuer :id])
-                                                        :content (get-in assertion [:endorsement :claim :endorsementComment])
-                                                        :status "accepted"
-                                                        :ctime (u/str->epoch (get-in assertion [:endorsement :issuedOn]))
-                                                        :mtime (u/str->epoch (get-in assertion [:endorsement :issuedOn]))
-                                                        }]
-
-                      (coll? (:endorsement assertion)) (mapv (fn [e]
-                                                              {:id nil
-                                                               :external_id (get-in assertion [:endorsement :id])
-                                                               :user_badge_id nil
-                                                               :issuer_id nil
-                                                               :issuer_name (get-in assertion [:endorsement :issuer :name])
-                                                               :issuer_url (get-in assertion [:endorsement :issuer :id])
-                                                               :content (get-in assertion [:endorsement :claim :endorsementComment])
-                                                               :status "accepted"
-                                                               :ctime (u/str->epoch (get-in assertion [:endorsement :issuedOn]))
-                                                               :mtime (u/str->epoch (get-in assertion [:endorsement :issuedOn]))
-                                                               }) (:endorsement assertion))
-                      :else []
-                      ) ]
-
+        endorsement (get-assertion-endorsement assertion) #_(cond
+                                                    (map? (:endorsement assertion)) [{:id nil
+                                                                                      :external_id (get-in assertion [:endorsement :id])
+                                                                                      :user_badge_id nil
+                                                                                      :issuer_id nil
+                                                                                      :issuer_name (get-in assertion [:endorsement :issuer :name])
+                                                                                      :issuer_url (get-in assertion [:endorsement :issuer :id])
+                                                                                      :content (get-in assertion [:endorsement :claim :endorsementComment])
+                                                                                      :status "accepted"
+                                                                                      :ctime (u/str->epoch (get-in assertion [:endorsement :issuedOn]))
+                                                                                      :mtime (u/str->epoch (get-in assertion [:endorsement :issuedOn]))
+                                                                                      }]
+
+                                                    (coll? (:endorsement assertion)) (mapv (fn [e]
+                                                                                             {:id nil
+                                                                                              :external_id (get-in assertion [:endorsement :id])
+                                                                                              :user_badge_id nil
+                                                                                              :issuer_id nil
+                                                                                              :issuer_name (get-in assertion [:endorsement :issuer :name])
+                                                                                              :issuer_url (get-in assertion [:endorsement :issuer :id])
+                                                                                              :content (get-in assertion [:endorsement :claim :endorsementComment])
+                                                                                              :status "accepted"
+                                                                                              :ctime (u/str->epoch (get-in assertion [:endorsement :issuedOn]))
+                                                                                              :mtime (u/str->epoch (get-in assertion [:endorsement :issuedOn]))
+                                                                                              }) (:endorsement assertion))
+                                                    :else []
+                                                    ) ]
     (assoc initial
       :badge (merge {:id ""
                      :remote_url nil

                       :audience (s/maybe s/Str)
                       :ctime s/Int
                       :mtime s/Int})


(s/defschema UserBadge {:id (s/maybe s/Int)

                                   http/json-get
                                   (get-endorsement (dec depth))))
                     (assoc-in e [:issuer :endorsement] [])))))))))

(defn- get-assertion-endorsement [assertion]
  (let [endorsement (:endorsement assertion)]
    (if (empty? endorsement)
      []
      (->> endorsement
           (map #(if (map? %) {:id nil
                               :external_id (:id %)
                               :user_badge_id nil
                               :issuer_id nil
                               :issuer_name (get-in % [:issuer :name] nil)
                               :issuer_url (get-in % [:issuer :id] nil)
                               :content (get-in % [:claim :endorsementComment])
                               :ctime (u/str->epoch (:issuedOn %))
                               :mtime (u/str->epoch (:issuedOn %))}

                   (http/json-get %)))
           (map (fn [e] {:id nil
                         :external_id (:id e)
                         :user_badge_id nil
                         :issuer_id nil
                         :issuer_name (get-in e [:issuer :name] nil)
                         :issuer_url (get-in e [:issuer :id] nil)
                         :content (get-in e [:claim :endorsementComment])
                         :ctime (u/str->epoch (:issuedOn e))
                         :mtime (u/str->epoch (:issuedOn e))}))))))

(defn- get-alignment [badge]
  (map (fn [a]
