public static List<MusicProtocol.MusicPlaylist> convertToAppleMusicPlaylist(Collection<MusicPlaylist> musicPlaylists) {
        List<MusicProtocol.MusicPlaylist> convertedPlaylists = new ArrayList<>();
        for (MusicPlaylist playlist : musicPlaylists) {
            if (playlist == null) {
                throw new IllegalStateException("MusicPlaylist cannot be null");
            }

            MusicProtocol.MusicPlaylist.Builder playlistBuilder = MusicProtocol.MusicPlaylist.newBuilder();

            if (!StringUtils.isBlank(playlist.getId())) {
                playlistBuilder.setId(playlist.getId());
            }

            if (!StringUtils.isBlank(playlist.getTitle())) {
                playlistBuilder.setTitle(playlist.getTitle());
            }

            if (!StringUtils.isBlank(playlist.getDescription())) {
                playlistBuilder.setDescription(playlist.getDescription());
            }

            if (playlist.getTimeCreated() != null) {
                playlistBuilder.setTimeCreated(playlist.getTimeCreated().toEpochMilli());
            }

            if (playlist.getTimeUpdated() != null) {
                playlistBuilder.setTimeUpdated(playlist.getTimeUpdated().toEpochMilli());
            }

            convertedPlaylists.add(playlistBuilder.build());
        }

        return convertedPlaylists;
    }
@Test
    public void testConvertToAppleMusicPlaylist() {
        String expectedId1 = "expectedId1";
        String expectedTitle1 = "Expected Title 1";
        String expectedDescription1 = "Expected Description";
        Instant expectedTimeCreated1 = Instant.now();
        Instant expectedTimeUpdated1 = expectedTimeCreated1.plusMillis(10000L);

        // No playlists
        List<MusicProtocol.MusicPlaylist> emptyCollectionMusicPlaylists = AppleMusicPlaylistConverter.convertToAppleMusicPlaylist(List.of());
        Assertions.assertNotNull(emptyCollectionMusicPlaylists);
        Assertions.assertTrue(emptyCollectionMusicPlaylists.isEmpty());

        // Null playlist
        List<MusicPlaylist> nullPlaylists = new ArrayList<>();
        nullPlaylists.add(null);
        Assertions.assertThrows(IllegalStateException.class, () -> AppleMusicPlaylistConverter.convertToAppleMusicPlaylist(nullPlaylists));

        // One playlist
        MusicPlaylist fullMusicPlaylist = new MusicPlaylist(expectedId1, expectedTitle1, expectedDescription1, expectedTimeCreated1, expectedTimeUpdated1);
        List<MusicPlaylist> musicPlaylists = new ArrayList<>();
        musicPlaylists.add(fullMusicPlaylist);
        List<MusicProtocol.MusicPlaylist> validPlaylistMusicPlaylists = AppleMusicPlaylistConverter.convertToAppleMusicPlaylist(musicPlaylists);
        Assertions.assertNotNull(validPlaylistMusicPlaylists);
        Assertions.assertFalse(validPlaylistMusicPlaylists.isEmpty());
        MusicProtocol.MusicPlaylist validMusicPlaylist = validPlaylistMusicPlaylists.get(0);
        Assertions.assertNotNull(validMusicPlaylist);
        Assertions.assertTrue(validMusicPlaylist.hasId());
        Assertions.assertEquals(validMusicPlaylist.getId(), expectedId1);
        Assertions.assertTrue(validMusicPlaylist.hasDescription());
        Assertions.assertEquals(validMusicPlaylist.getDescription(), expectedDescription1);
        Assertions.assertTrue(validMusicPlaylist.hasTimeCreated());
        Assertions.assertEquals(validMusicPlaylist.getTimeCreated(), expectedTimeCreated1.toEpochMilli());
        Assertions.assertTrue(validMusicPlaylist.hasTimeUpdated());
        Assertions.assertEquals(validMusicPlaylist.getTimeUpdated(), expectedTimeUpdated1.toEpochMilli());

        // Totally invalid MusicPlaylist
        MusicPlaylist invalidMusicPlaylist = new MusicPlaylist(expectedId1, null, null, null, null);
        List<MusicProtocol.MusicPlaylist> invalidMusicPlaylists = AppleMusicPlaylistConverter.convertToAppleMusicPlaylist(List.of(invalidMusicPlaylist));
        Assertions.assertNotNull(invalidMusicPlaylists);
        Assertions.assertFalse(invalidMusicPlaylists.isEmpty());
        MusicProtocol.MusicPlaylist invalidMusicPlaylistResult = invalidMusicPlaylists.get(0);
        Assertions.assertNotNull(invalidMusicPlaylistResult);
        Assertions.assertTrue(invalidMusicPlaylistResult.hasId());
        Assertions.assertEquals(invalidMusicPlaylistResult.getId(), expectedId1);
        Assertions.assertFalse(invalidMusicPlaylistResult.hasDescription());
        Assertions.assertFalse(invalidMusicPlaylistResult.hasTimeCreated());
        Assertions.assertFalse(invalidMusicPlaylistResult.hasTimeUpdated());
    }