 (defn create-user!
   "creates a user, returns id"
   [{:keys [id email avatar nickname password]}]
-  (let [new-id (d/tempid :entities)
-        {:keys  [db-after tempids]} @(d/transact *conn*
-                                       [[:add-user
-                                         {:db/id new-id
-                                          :user/id id
-                                          :user/email email
-                                          :user/avatar avatar
-                                          :user/password-token (password/encrypt password)}]])]
-    (->> (d/resolve-tempid db-after tempids new-id)
-         (d/entity db-after)
-         db->user)))
+  (-> {:user/id id
+       :user/email email
+       :user/avatar avatar
+       :user/password-token (password/encrypt password)}
+      create-entity!
+      db->user))
 
 (defn nickname-taken?
   [nickname]

      {:db/ident :user/email
       :db/valueType :db.type/string
       :db/cardinality :db.cardinality/one
       :db/unique :db.unique/identity
       :db/id #db/id [:db.part/db]
       :db.install/_attribute :db.part/db}
      {:db/ident :user/nickname
       :db/valueType :db.type/string
       :db/cardinality :db.cardinality/one
       :db/unique :db.unique/identity
       :db/id #db/id [:db.part/db]
       :db.install/_attribute :db.part/db}
      {:db/ident :user/password-token

       :db/cardinality :db.cardinality/many
       :db/id #db/id [:db.part/db]
       :db.install/_attribute :db.part/db}

      ; message
      {:db/ident :message/id
