Insert events into history.asArray so that they are ordered in time

Using binary search to find appropriate position, so that history.asArray contains ordered event instances.