public async Task <IEnumerable <FullTrack> > GetNextTracksAsync(PlaybackSessionInfo session, string finishedSongUri = null, int previewCount = 2)
        {
            // Call spotifyApi to get playlist from playlistId
            // TODO this will have performance issues for larger playlists. Instead use the limit: and offset: params

            List <PlaylistTrack> playlistTracks;

            playlistTracks = (await _spotifyApi.GetPlaylistTracksAsync(null, session.SpotifyPlaylistId))
                             .Items;

            // Get next track by finding the one after the finished song uri
            var finishedIndex = playlistTracks.FindIndex(t => t.Track.Uri == finishedSongUri);

            // Next song, or start back at 0
            var nextIndex = finishedIndex >= playlistTracks.Count - 1 ? 0 : finishedIndex + 1;

            // Take next track, plus preview tracks
            var requiredCount = 1 + previewCount;

            // Get the next song, and the previews
            var nextTracks = playlistTracks.Skip(nextIndex).Take(requiredCount).ToList();

            // If we are at the end of the playlist, get the previews from the start
            if (nextTracks.Count() < requiredCount)
            {
                var take = requiredCount - nextTracks.Count();
                nextTracks.AddRange(playlistTracks.Take(take));
            }

            return(nextTracks.Select(t => t.Track));
        }
        public async Task <IActionResult> GetCurrentPlayback(string voiceChannelId)
        {
            var session = await _playbackRepo.GetByDiscordIdAsync(voiceChannelId, new PlaybackSessionQueryOptions()
            {
                IncludeCurrentPlayback = true
            });

            if (session == null)
            {
                return(Ok(null));
            }
            var sessionInfo = new PlaybackSessionInfo()
            {
                SpotifyPlaylistId     = session.SpotifyPlaylistId,
                DiscordVoiceChannelId = session.DiscordVoiceChannelId
            };

            return(Ok(sessionInfo));
        }