public async Task <ActionResult> Index()
        {
            QuizModeType selectedModeType = await this.modesService.GetSelectedMode();

            var bindingModel = new QuizModeBindingModel {
                Type = selectedModeType
            };

            return(this.View(bindingModel));
        }
        public async Task <int> UpdateMode(QuizModeType newType)
        {
            var selectedMode = await modesRepository.GetAll()
                               .Where(x => x.IsSelected)
                               .FirstOrDefaultAsync();

            if (selectedMode.Type != newType)
            {
                selectedMode.IsSelected = false;
                var modeToBeSelected = await modesRepository.GetAll()
                                       .Where(x => x.Type == newType)
                                       .FirstOrDefaultAsync();

                modeToBeSelected.IsSelected = true;

                return(await modesRepository.Update(modeToBeSelected));
            }

            return(0); //Nothing changed, zero rows affected.
        }