             // permenantly delete the model
             query.action = .delete
             try query.filter(E.idKey, id)
-            try type(of: entity).willDelete(entity: entity)
+            try E.willDelete(entity: entity)
             try entity.willDelete()
             try query.raw()
-            type(of: entity).didDelete(entity: entity)
+            E.didDelete(entity: entity)
             entity.didDelete()
             entity.exists = false
         }

                // for models without them
                entity.id = Identifier(UUID.random())
            }
            try type(of: entity).willCreate(entity: entity)
            try entity.willCreate()
            var row = try entity.makeRow()
            try row.set(E.idKey, entity.id)

                entity.id = id
            }

            E.didCreate(entity: entity)
            entity.didCreate()
        }
        entity.exists = true
