/// <summary>
        /// Marks the YouTube video specified as used.
        /// </summary>
        public async Task MarkVideoAsUsed(YouTubeVideo video)
        {
            // Mark all videos as used using queries in parallel
            PreparedStatement prepared = await _statementCache.NoContext.GetOrAddAsync(
                "UPDATE sample_data_youtube_videos SET used = true WHERE sourceid = ? AND published_at = ? AND youtube_video_id = ?");

            await _session.ExecuteAsync(prepared.Bind(video.Source.UniqueId, video.PublishedAt, video.YouTubeVideoId)).ConfigureAwait(false);
        }
        private static YouTubeVideo MapToYouTubeVideo(Row row, YouTubeVideoSource source, Random random)
        {
            // Map to video
            var video = new YouTubeVideo
            {
                Source         = source,
                PublishedAt    = row.GetValue <DateTimeOffset>("published_at"),
                YouTubeVideoId = row.GetValue <string>("youtube_video_id"),
                Name           = row.GetValue <string>("name"),
                Description    = row.GetValue <string>("description")
            };

            // Choose some tags for the video (this isn't a fantastic way to do this, but since it's sample data, it will do)
            var tags    = new HashSet <string>();
            int maxTags = random.Next(3, 6);

            string lowerName        = video.Name.ToLowerInvariant();
            string lowerDescription = video.Description.ToLowerInvariant();

            foreach (string possibleTag in source.PossibleTags)
            {
                if (lowerName.Contains(possibleTag) || lowerDescription.Contains(possibleTag))
                {
                    tags.Add(possibleTag);
                }

                if (tags.Count == maxTags)
                {
                    break;
                }
            }

            // If we didn't get any tags, just pick some random ones specific to the source
            if (tags.Count == 0)
            {
                foreach (string tag in source.SourceTags.Take(maxTags))
                {
                    tags.Add(tag);
                }
            }

            // Return video with suggested tags
            video.SuggestedTags = tags;
            return(video);
        }