Try to `commit` before sending email/notification

* Otherwise, the user got information that is incompatible with the
  state of the database