def _update_lobbyist_corporations(self, lobbyist_history):
        corporation_lobbyists = {}
        for lobbyist in lobbyist_history.lobbyists.all():
            corporation, is_created = LobbyistCorporation.objects.get_or_create(
                source_id=lobbyist.latest_data.corporation_id, name=lobbyist.latest_data.corporation_name
            )
            if not corporation.id in corporation_lobbyists:
                corporation_lobbyists[corporation.id] = []
            corporation_lobbyists[corporation.id].append(lobbyist.id)
        for corporation_id in corporation_lobbyists:
            lobbyist_ids = sorted(corporation_lobbyists[corporation_id])
            corporation = LobbyistCorporation.objects.get(id=corporation_id)
            need_corporation_data = True
            try:
                corporation_data = corporation.latest_data
                if corporation_data.name == corporation.name and corporation_data.source_id == corporation.source_id:
                    last_lobbyist_ids = map(lambda lobbyist: lobbyist.id, sorted(corporation_data.lobbyists.all(), key=lambda lobbyist: lobbyist.id))
                    if last_lobbyist_ids == lobbyist_ids:
                        need_corporation_data = False
            except __HOLE__:
                pass
            if need_corporation_data:
                corporation_data = LobbyistCorporationData.objects.create(
                    name=corporation.name, source_id=corporation.source_id
                )
                for id in lobbyist_ids:
                    corporation_data.lobbyists.add(Lobbyist.objects.get(id=id))
                corporation_data.scrape_time = datetime.now()
                corporation_data.save()
                corporation.data.add(corporation_data)
                corporation.save()
dataset/ETHPy150Open ofri/Open-Knesset/lobbyists/scrapers/__init__.py/MainScraperListStorage._update_lobbyist_corporations