Add alarm event with storeTagHistory

I’m using system.tag.storeTagHistory() to manually add historical data to a tag. What I’d like is to also add an (historical) event to the alarm journal for any value that would have triggered an alarm had it been an actual live tag value.
The only way I see at the moment to achieve this is by sequentially checking each alarm condition on the tag for each value to see if the value would have activated the alarm. Then, if the alarm was activated, directly writing to the alarm_events table in the database.
I think this should be possible, though non-trivial, but one thing I’m unsure about is how to generate a unique event id (aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa) when inserting an event into the database.

Any ideas, or suggestions for a much simpler approach?

I’ve now written a script that analyses the alarm conditions for a tag when adding historical data and returns a list of ‘alarm events’ for that data. Now, I want to add these events to the alarm journal by writing to the alarm_events database table.
The problem still is creating a unique eventid that matches the exisiting format (which appears to be [8 hex-digits]-[4 hex-digits]-[4 hex-digits]-[4 hex-digits]-[12 hex-digits]).
Does anyone know how to go about properly generating this?