function sortEvents(events) {
  //   return Object.keys(events)
  //     .sort()
  //     .reduce((sortedEvents, key) => {
  //       sortedEvents[key] = events[key];
  //       return sortedEvents;
  //     }, {});

  const sortedEvents = {};
  Object.keys(events)
    .sort()
    .forEach((key) => {
      sortedEvents[key] = events[key];
    });
  return sortedEvents;
}