Add event creation library and implement in scheduler.

It's easy to unit test and it's already done, so I'm not going to take it out. But I agree that an e2e test is also appropriate.