def load_media(self, max_pages=150):
        """
        Load all WordPress media from the given site.

        :param max_pages: kill counter to avoid infinite looping
        :return: None
        """
        logger.info("loading media")

        # clear them all out so we don't get dupes
        if self.purge_first:
            logger.warning("purging ALL media from site %s", self.site_id)
            Media.objects.filter(site_id=self.site_id).delete()

        path = "sites/{}/media".format(self.site_id)
        params = {"number": 100}
        self.set_media_params_after(params)
        page = 1

        response = self.get(path, params)

        if not response.ok:
            logger.warning("Response NOT OK! status_code=%s\n%s", response.status_code, response.text)

        while response.ok and response.text and page < max_pages:
            logger.info(" - page: %d", page)

            api_medias = response.json().get("media")
            if not api_medias:
                # we're done here
                break

            medias = []
            for api_media in api_medias:

                # exclude media items that are not attached to posts (for now)
                if api_media["post_ID"] != 0:

                    # if it exists locally, update local version if anything has changed
                    existing_media = Media.objects.filter(site_id=self.site_id, wp_id=api_media["ID"]).first()
                    if existing_media:
                        self.update_existing_media(existing_media, api_media)
                    else:
                        medias.append(self.get_new_media(api_media))

            if medias:
                Media.objects.bulk_create(medias)

            # get next page
            page += 1
            params["page"] = page
            response = self.get(path, params)

            if not response.ok:
                logger.warning("Response NOT OK! status_code=%s\n%s", response.status_code, response.text)
                return