Trying to sort events array