     (if id
       (update-user-badge-evidence! {:url url :id id} (u/get-db ctx))
       (insert-user-badge-evidence-url<! {:user_badge_id user-badge-id :url url} (u/get-db ctx)))))
+
+
+(defn save-badge-evidence [ctx user-id user-badge-id evidence-id name description audience genre url narrative]
+    (try+
+      (if (badge-owner? ctx user-badge-id user-id)
+        (let [data {:user_badge_id user-badge-id :url url :narrative narrative :name name :description description :genre genre :audience audience}]
+          (if evidence-id
+            (update-user-badge-evidence2! (assoc data :id evidence-id) #_{:id evidence-id :user_badge_id user-badge-id :url url :narrative narrative :name name :description description :genre genre :audience audience} (u/get-db ctx))
+            (insert-evidence<! data #_{:user_badge_id user-badge-id :url url :narrative narrative :name name :description description :genre genre :audience audience} (u/get-db ctx))
+            )
+          {:status "success"})
+        (throw+ {:status "error"})
+        )
+      (catch Object _
+        (log/error _)
+        {:status "error"})
+      ))
+
+(defn delete-evidence! [ctx evidence-id user-badge-id user-id]
+  (try+
+    (if (badge-owner? ctx user-badge-id user-id)
+      (do
+        (delete-user-badge-evidence! {:id evidence-id :user_badge_id user-badge-id} (u/get-db ctx))
+        {:status "success"})
+
+      {:status "error"})
+
+    (catch Object _
+    (log/error _)
+    {:status "error"}))
+  )
+
 
 ;TODO rework evidence
 (defn save-badge-settings!

            [clojure.tools.logging :as log]
            [clojure.java.jdbc :as jdbc]
            [clojure.set :refer [rename-keys]]
            [clojure.string :refer [blank? split upper-case lower-case capitalize includes?]]
            [slingshot.slingshot :refer :all]
            [clojure.data.json :as json]
            [salava.core.time :refer [unix-time date-from-unix-time]]

                 :revoked (check-badge-revoked ctx badge-id (:revoked badge) (:assertion_url badge) (:last_checked badge))
                 :assertion (parse-assertion-json (:assertion_json badge))

                 :qr_code (u/str->qr-base64 (badge-url ctx badge-id))
              ;;
                 :evidences evidences
      )))


(defn get-endorsements [ctx badge-id]
