Allow setting the event uid

If the event.uid is defined, it is used as the event's uid.
Otherwise, a uid is generated.