@Override
    public ImportResult importItem(
            UUID jobId,
            IdempotentImportExecutor idempotentImportExecutor,
            TokensAndUrlAuthData authData,
            MusicContainerResource data)
            throws Exception {

        if (data == null) {
            // Nothing to do
            return new ImportResult(new AppleContentException("Null MusicContainerResource received on AppleMusicImporter::importItem"));
        }

        int playlistsCount = 0;
        int playlistItemsCount = 0;

        AppleMusicInterface musicInterface = factory
                .getOrCreateMusicInterface(jobId, authData, appCredentials, exportingService, monitor);

        if (!data.getPlaylists().isEmpty()) {
            playlistsCount = musicInterface.importPlaylists(jobId, idempotentImportExecutor, data.getPlaylists());
        }

        if (!data.getPlaylistItems().isEmpty()) {
            playlistItemsCount = musicInterface.importMusicPlaylistItems(jobId, idempotentImportExecutor, data.getPlaylistItems());
        }

        final Map<String, Integer> counts =
                new ImmutableMap.Builder<String, Integer>()
                        .put(AppleMusicConstants.PLAYLISTS_COUNT_DATA_NAME, playlistsCount)
                        .put(AppleMusicConstants.PLAYLIST_ITEMS_COUNT_DATA_NAME, playlistItemsCount)
                        .build();
        return ImportResult.OK
                .copyWithCounts(counts);
    }
@Test
    public void testImportPlaylistTracks() throws Exception {
        List<MusicPlaylistItem> musicPlaylistItems = createTestPlaylistItems(randomString());
        setUpImportPlaylistTracksBatchResponse(musicPlaylistItems.stream().collect(
                Collectors.toMap(item -> item.getTrack().getIsrcCode(), item -> SC_OK)));

        MusicContainerResource playlistItemsResource = new MusicContainerResource(null, musicPlaylistItems, null, null);

        final ImportResult importResult = appleMusicImporter.importItem(uuid, executor, authData, playlistItemsResource);

        verify(appleMusicInterface)
                .importMusicPlaylistItemsBatch(uuid.toString(), musicPlaylistItems);

        assertThat(importResult.getCounts().isPresent());

        assertThat(importResult.getCounts().get().get(AppleMusicConstants.PLAYLIST_ITEMS_COUNT_DATA_NAME) == playlistItemsResource.getPlaylistItems().size());

        assertThat(importResult.getCounts().get().get(AppleMusicConstants.PLAYLISTS_COUNT_DATA_NAME) == 0);
    }