// GET: Test/Index
        public ActionResult Index()
        {
            try
            {
                // Clear properties for processing a test period.
                TestPeriod    = 0;
                StartTestTime = null;

                // I. AutoMapper Setup.
                var config = new MapperConfiguration(cfg =>
                {
                    cfg.CreateMap <SubjectDTO, SubjectViewModel>()
                    .ForMember("Id", opt => opt.MapFrom(obj => obj.SubjectId))
                    .ForMember("Name", opt => opt.MapFrom(obj => obj.SubjectName));
                });
                IMapper iMapper = config.CreateMapper();

                // II. Get data for a view.
                IEnumerable <SubjectViewModel> subjects = iMapper.Map <IEnumerable <SubjectDTO>, IEnumerable <SubjectViewModel> >(SubjectService.Find(sub => sub.IsApproved == true))
                                                          .OrderBy(obj => obj.Name);

                //// Clear Session["TestPeriod"] which keeps timer period.
                //Session["TestPeriod"] = null;

                // III.
                return(View(subjects));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
        // GET: ModeratorSuscription/Index
        public ActionResult Index()
        {
            try
            {
                //I. Check.
                // Get Id for the current user.
                string currentUserId = System.Web.HttpContext.Current.User.Identity.GetUserId();
                if (currentUserId == null)
                {
                    return(RedirectToAction("Login", "Account"));
                }

                // II. Set ViewBag properties.
                PLRepository.SetViewBagProperiesForModeratorSubscription(UserService, currentUserId,
                                                                         SubscriptionForModeratorService,
                                                                         out bool?viewBagIsAllowedToSuggest,
                                                                         out bool?viewBagGoToTrialSubscription,
                                                                         out bool?viewBagGoToSubscription);
                ViewBag.IsAllowedToSuggest    = viewBagIsAllowedToSuggest;
                ViewBag.GoToTrialSubscription = viewBagGoToTrialSubscription;
                ViewBag.GoToSubscription      = viewBagGoToSubscription;

                // III. AutoMapper Setup.
                var config = new MapperConfiguration(cfg =>
                {
                    cfg.CreateMap <SubjectDTO, SubjectViewModel>()
                    .ForMember("Id", opt => opt.MapFrom(obj => obj.SubjectId))
                    .ForMember("Name", opt => opt.MapFrom(obj => obj.SubjectName));
                });
                IMapper iMapper = config.CreateMapper();

                // IV. Get data for a view.
                IEnumerable <SubjectViewModel> subjects = iMapper.Map <IEnumerable <SubjectDTO>, IEnumerable <SubjectViewModel> >(SubjectService.Find(subject => subject.IsApproved))
                                                          .OrderBy(obj => obj.Name);

                // V.
                return(View(subjects));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }