internal MetadataToVorbisCommentAdapter([NotNull] AudioMetadata metadata)
        {
            SafeNativeMethods.VorbisCommentInit(out _comment);

            if (!string.IsNullOrEmpty(metadata.Title))
            {
                AddTag("TITLE", metadata.Title);
            }
            if (!string.IsNullOrEmpty(metadata.Artist))
            {
                AddTag("ARTIST", metadata.Artist);
            }
            if (!string.IsNullOrEmpty(metadata.Album))
            {
                AddTag("ALBUM", metadata.Album);
            }
            if (!string.IsNullOrEmpty(metadata.AlbumArtist))
            {
                AddTag("ALBUMARTIST", metadata.AlbumArtist);
            }
            if (!string.IsNullOrEmpty(metadata.Composer))
            {
                AddTag("COMPOSER", metadata.Composer);
            }
            if (!string.IsNullOrEmpty(metadata.Genre))
            {
                AddTag("GENRE", metadata.Genre);
            }
            if (!string.IsNullOrEmpty(metadata.Comment))
            {
                AddTag("DESCRIPTION", metadata.Comment);
            }

            if (!string.IsNullOrEmpty(metadata.Day) &&
                !string.IsNullOrEmpty(metadata.Month) &&
                !string.IsNullOrEmpty(metadata.Year))
            {
                AddTag("DATE", $"{metadata.Year}-{metadata.Month}-{metadata.Day}");
            }
            else if (!string.IsNullOrEmpty(metadata.Year))
            {
                AddTag("YEAR", metadata.Year);
            }

            if (!string.IsNullOrEmpty(metadata.TrackNumber))
            {
                AddTag("TRACKNUMBER", !string.IsNullOrEmpty(metadata.TrackCount)
                    ? $"{metadata.TrackNumber}/{metadata.TrackCount}"
                    : metadata.TrackNumber);
            }

            if (!string.IsNullOrEmpty(metadata.TrackPeak))
            {
                AddTag("REPLAYGAIN_TRACK_PEAK", metadata.TrackPeak);
            }
            if (!string.IsNullOrEmpty(metadata.AlbumPeak))
            {
                AddTag("REPLAYGAIN_ALBUM_PEAK", metadata.AlbumPeak);
            }
            if (!string.IsNullOrEmpty(metadata.TrackGain))
            {
                AddTag("REPLAYGAIN_TRACK_GAIN", $"{metadata.TrackGain} dB");
            }
            if (!string.IsNullOrEmpty(metadata.AlbumGain))
            {
                AddTag("REPLAYGAIN_ALBUM_GAIN", $"{metadata.AlbumGain} dB");
            }

            // Always store images in JPEG format since Vorbis is also lossy
            if (metadata.CoverArt != null)
            {
                AddTag("METADATA_BLOCK_PICTURE", CoverArtAdapter.ToBase64(
                           CoverArtFactory.ConvertToLossy(metadata.CoverArt)));
            }
        }