 
 (defn- update-email [user-id old-email new-email]
   (if (sql-primitive (call-sql "email_taken" new-email user-id))
-    {:status  200
-     :headers {"Content-Type" "application/json"}
-     :body    (str "An account with the email " new-email " already exists.")}
+    (data-response (str "An account with the email " new-email " already exists."))
     (do
       (call-sql "set_user_email" old-email new-email)
-      {:status  200
-       :headers {"Content-Type" "application/json"}
-       :body    ""
-       :session {:userName new-email}})))
+      (data-response "" {:session {:userName new-email}}))))
 
 (defn update-account [{:keys [params]}]
   (let [user-id               (Integer/parseInt (or (:userId params) "-1"))

                            (.toSeconds)
                            (- (get-mailing-list-interval)))]
    (if (pos? remaining-time)
      {:status  200
       :headers {"Content-Type" "application/json"}
       :body    (str "You must wait " remaining-time " more seconds before sending another message.")}
      (if (or (str/blank? subject) (str/blank? body))
        {:status  200
         :headers {"Content-Type" "application/json"}
         :body    "Subject and Body are mandatory fields."}
        (let [emails (mapv :email (call-sql "get_all_mailing_list_users"))]
          (send-to-mailing-list emails subject body "text/html")
          (set-mailing-list-last-sent! (LocalDateTime/now))
          {:status  200
           :headers {"Content-Type" "application/json"}
           :body    ""})))))

(defn unsubscribe-from-mailing-list [request]
  (let [email (-> request :params :email)]

                           :email email
                           :role  (if administrator "admin" "user")})
                        (call-sql "get_all_users"))]
    (data-response all-users)))

(defn get-institution-users [request]
  (let [institution-id (Integer/parseInt (-> request :params :institutionId))
