adding main function for getting and saving events to database