 
 (defn new-commodity
   ([{{entity-id :entity-id} :params :as req}]
-   (new-commodity req {:entity-id entity-id}))
+   (new-commodity req (-> {:entity-id entity-id}
+                          (tag-resource :commodity)
+                          (authorize :new))))
   ([{{entity :entity} :params} commodity]
    (with-layout "New commodity" {:entity entity}
      [:div.row

            [clojure.tools.logging :as log]
            [clj-money.util :refer [format-number]]
            [clj-money.web.shared :refer :all]
            [clj-money.validation :as validation]
            [clj-money.models.commodities :as commodities]
            [clj-money.models.prices :as prices]))

  [{params :params}]
  (let [commodity (commodities/create
                    (env :db)
                    (-> params
                        (select-keys [:entity-id
                                      :name
                                      :symbol
                                      :exchange
                                      :type])
                        (tag-resource :commodity)
                        (authorize :create)))]
    (if (validation/has-error? commodity)
      (new-commodity {} commodity)
      (redirect (format "/entities/%s/commodities" (:entity-id commodity))))))

(defn edit
  ([{params :params :as req}]
   (let [id (:id params)
         commodity (authorize (commodities/find-by-id (env :db) id) :edit)]
     (edit req commodity)))
  ([_ commodity]
   (with-layout "Edit commodity" {:entity-id (:entity-id commodity)}
