Add users, events to database and some error checking