added event model and cloud function