public int importMusicPlaylistItems(
            final UUID jobId,
            IdempotentImportExecutor idempotentImportExecutor,
            List<MusicPlaylistItem> musicPlaylistItems) throws Exception {

        UnmodifiableIterator<List<MusicPlaylistItem>> batches = Iterators.partition(musicPlaylistItems.iterator(), AppleMusicConstants.MAX_NEW_PLAYLIST_ITEM_REQUESTS);
        AtomicInteger successItemsCount = new AtomicInteger(0);

        while (batches.hasNext()) {
            MusicProtocol.ImportMusicPlaylistTracksResponse importMusicPlaylistTracksResponse = importMusicPlaylistItemsBatch(jobId.toString(), batches.next());

            for (MusicProtocol.MusicPlaylistTrackResponse trackResponse : importMusicPlaylistTracksResponse.getMusicPlaylistTrackResponseList()) {
                String trackId = trackResponse.getId();
                String trackName = trackResponse.getName();
                if (trackResponse.hasStatus() && trackResponse.getStatus().getCode() == SC_OK) {
                    successItemsCount.getAndIncrement();
                    idempotentImportExecutor.executeAndSwallowIOExceptions(
                            trackId,
                            trackName,
                            () -> {
                                monitor.debug(
                                        () -> "Apple importing music playlist track ",
                                        AuditKeys.jobId, jobId,
                                        AuditKeys.dataId, trackResponse.getId());
                                return trackResponse.getId();
                            });
                } else {
                    idempotentImportExecutor.executeAndSwallowIOExceptions(
                            trackId,
                            trackName,
                            () -> {
                                monitor.severe(
                                        () -> "Error importing playlist track: ",
                                        AuditKeys.jobId, jobId,
                                        AuditKeys.dataId, trackResponse.getId());

                                throw new IOException(
                                        String.format(
                                                "Failed to import playlist track, error code: %d, error message: %s",
                                                trackResponse.getStatus().getCode(),
                                                trackResponse.getStatus().getMessage()));
                            });
                }
            }
        }
        return successItemsCount.get();
    }
@return the total number of playlist tracks acknowledged by the Apple Music Library Service in this page
extensions/data-transfer/portability-data-transfer-apple/src/main/java/org/datatransferproject/datatransfer/apple/music/AppleMusicInterface.java