save event to database