def METHOD_NAME(record):
    """Create a document and a holding for a harvested ebook."""
    harvested_sources = get_harvested_sources(record)
    new_record = None
    for harvested_source in harvested_sources:
        if org := Organisation.get_record_by_online_harvested_source(
                source=harvested_source['source']):
            if not new_record:
                new_record = Document.create(
                    data=record,
                    dbcommit=True,
                    reindex=True
                )
                DocumentsSearch.flush_and_refresh()
            if new_record:
                item_type_pid = org.online_circulation_category()
                location_pids = org.get_online_locations()
                for location_pid in location_pids:
                    location = Location.get_record_by_pid(location_pid)
                    library = location.get_library()
                    if url := library.get_online_harvested_source_url(
                            source=harvested_source['source']):
                        uri_split = harvested_source['uri'].split('/')[3:]
                        uri_split.insert(0, url.rstrip('/'))
                        harvested_source['uri'] = '/'.join(uri_split)
                    hold = create_holding(
                        document_pid=new_record.pid,
                        location_pid=location_pid,
                        item_type_pid=item_type_pid,
                        electronic_location=harvested_source,
                        holdings_type='electronic')
                HoldingsSearch.flush_and_refresh()
        else:
            current_app.logger.warning(
                f"create document holding no org: {harvested_source['source']}"
            )
    return new_record