BackgroundTasks.LightControllerVoiceCommandService.SelectColorAsync C# (CSharp) Method

SelectColorAsync() private method

Handles an interaction with Cortana where the user selects from randomly chosen colors to change the lights to.
private SelectColorAsync ( ) : System.Threading.Tasks.Task
return System.Threading.Tasks.Task
        private async Task SelectColorAsync()
        {
            var userPrompt = new VoiceCommandUserMessage();
            userPrompt.DisplayMessage = userPrompt.SpokenMessage = 
                "Here's some colors you can choose from.";

            var userReprompt = new VoiceCommandUserMessage();
            userReprompt.DisplayMessage = userReprompt.SpokenMessage = 
                "Sorry, didn't catch that. What color would you like to use?";

            // Randomly select 6 colors for Cortana to show
            var random = new Random();
            var colorContentTiles = _colors.Select(x => new VoiceCommandContentTile
            {
                ContentTileType = VoiceCommandContentTileType.TitleOnly,
                Title = x.Value.Name
            }).OrderBy(x => random.Next()).Take(6);

            var colorResponse = VoiceCommandResponse.CreateResponseForPrompt(
                userPrompt, userReprompt, colorContentTiles);
            var disambiguationResult = await 
                _voiceServiceConnection.RequestDisambiguationAsync(colorResponse);
            if (null != disambiguationResult)
            {
                var selectedColor = disambiguationResult.SelectedItem.Title;
                foreach (Light light in _lights)
                {
                    await ExecutePhrase(light, selectedColor);
                    await Task.Delay(500);
                }
                var response = CreateCortanaResponse($"Turned your lights {selectedColor}.");
                await _voiceServiceConnection.ReportSuccessAsync(response);
            }
        }