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;
    }
Helper class for converting incoming DTP format playlists and playlist-tracks to Apple Music format for transport to
Apple Music Data Transfer services.
extensions/data-transfer/portability-data-transfer-apple/src/main/java/org/datatransferproject/datatransfer/apple/music/data/converters/AppleMusicPlaylistConverter.java