public function populateDaxkoMembershipTypes() {
    $membership_data = $this->getMembershipData();
    $storage = $this->entityTypeManager->getStorage('mapping');

    $memberships = [];
    foreach ($membership_data as $daxko_branch_id => $data) {

      $branch = $this->locationRepo->getBranchByDaxkoBranchId($daxko_branch_id);
      foreach ($data as $membership_type) {
        // Skip membership types if they are hidden online.
        if ($membership_type->showOnline === FALSE) {
          continue;
        }

        try {
          $name = $this->getMembershipTypeName($membership_type);
          $membership_type->humanName = $name;
          $memberships[$branch->id()][$name][$membership_type->id] = $membership_type;
        }
        catch (\Exception $e) {
          $this->loggerChannel->error('Found unsupported membership type name "%name".', ['%name' => $membership_type->name]);
        }
      }
    }

    foreach ($memberships as $branch_id => $membership_items) {
      foreach ($membership_items as $membership_item_name => $membership_item) {
        // Try to update existing entity.
        $existing = $this->membershipTypeRepo->getMappingByNameAndBranch($membership_item_name, $branch_id);
        if (!empty($existing)) {
          // Update only IDs.
          $ids = [];
          foreach ($membership_item as $variation) {
            $ids[] = $variation->id;
          }
          $existing->set('field_daxko_membership_ids', $ids);
          $existing->save();
          continue;
        }

        $values = [
          'type' => 'membership_type',
          'langcode' => 'en',
          'field_branch_ct_reference' => $branch_id,
        ];

        foreach ($membership_item as $variation) {
          $values['field_daxko_membership_ids'][] = $variation->id;
        }

        $entity = $storage->create($values);
        $entity->setName($membership_item_name);
        $entity->setOwnerId(self::MAPPING_OWNER_ID);
        $entity->save();
      }
    }
  }