def _migrate_sessions(self):
        sessions = []
        friendly_id_map = {}
        friendly_ids_used = set()
        skipped = []
        for id_, session in sorted(self.old_event.sessions.items(),
                                   key=lambda x: (x[0].isdigit(), int(x[0]) if x[0].isdigit() else x[0])):
            id_ = int(id_.lstrip('s'))  # legacy: s123
            if id_ in friendly_ids_used:
                skipped.append(session)
                continue
            friendly_id_map[session] = id_
            friendly_ids_used.add(id_)
        for i, session in enumerate(skipped, (max(friendly_ids_used) if friendly_ids_used else 0) + 1):
            assert i not in friendly_ids_used
            friendly_id_map[session] = i
            friendly_ids_used.add(i)
        for old_session in self.old_event.sessions.itervalues():
            sessions.append(self._migrate_session(old_session, friendly_id_map[old_session]))
        if sessions:
            self.event._last_friendly_session_id = max(s.friendly_id for s in sessions)