Fix bug in isAccountValid() and isMessageValid()

Check if account and message actually exist in the DB.