added optimistic locking for task archive and trigger events