public static MusicProtocol.MusicTrack.Builder convertMusicRecordingToTrackBuilder(MusicRecording recording) {
        MusicProtocol.MusicTrack.Builder trackBuilder = MusicProtocol.MusicTrack.newBuilder();

        if (recording == null) {
            // Return an empty track
            // Tracks without metadata will be ignored by importing system.
            return trackBuilder;
        }

        if (!StringUtils.isBlank(recording.getTitle())) {
            trackBuilder.setTitle(recording.getTitle());
        }

        if (!StringUtils.isBlank(recording.getIsrcCode())) {
            trackBuilder.setIsrcCode(recording.getIsrcCode());
        }

        trackBuilder.setDurationMillis(recording.getDurationMillis());

        if (recording.getByArtists() != null && !recording.getByArtists().isEmpty()) {
            List<MusicProtocol.MusicArtist> trackArtists = convertMusicGroupsToMusicArtists(recording.getByArtists());
            if (!trackArtists.isEmpty()) {
                trackBuilder.addAllTrackArtist(trackArtists);
            }
        }

        if (recording.getMusicRelease() != null) {
            trackBuilder.setMusicAlbum(convertMusicReleaseToMusicAlbum(recording.getMusicRelease()));
        }

        trackBuilder.setIsExplicit(recording.getIsExplicit());

        return trackBuilder;
    }
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