RBAC for event summary with helper function

This code is not that efficient. Since the listOfItems is already sorted by time, you just need to scan it from beginning to end, and see if there is any gap and just insert the missing items there.