Resources here needs to be created by iterating over the events, both to preserve order, and since res.references is not guaranteed to be only the resources related to the events themselves.