public async Task PostAnswer(QuestionaireModel model, string username)
        {
            var userId = GetUserIdByEmail(username);
            var answer = Entities.Questionaires.FirstOrDefault(u => u.UserId == userId);

            if (answer == null)
            {
                answer = new Questionaire();
            }

            answer.UserId = userId;
            answer.YearOfBirth = model.YearOfBirth;
            answer.Sex = model.Sex.ToString();
            answer.Occupation = model.Occupation;
            answer.Height = model.Height;
            answer.Weight = model.Weight;
            answer.ActivityLevel = model.ActivityLevel.ToString();

            Entities.Questionaires.AddOrUpdate(answer);
            await Entities.SaveChangesAsync();
        }
        public async Task<ActionResult> Index(QuestionaireModel model)
        {
            if (!ModelState.IsValid)
            {
                model.IsValid = false;
                model.ErrorMessage = Strings.FixValidationErrors;
                return View(model);
            }

            var username = User.Identity.Name;
            if (string.IsNullOrWhiteSpace(username))
            {
                FormsAuthentication.SignOut();
                return RedirectToAction("Login");
            }

            InitializeYears();

            try
            {
                await _questionaire.PostAnswer(model, username);
                model.InformationMessage =  Strings.QuestionaireSuccessfullyUpdated;
            }
            catch (ArgumentException ex)
            {
                model.IsValid = false;
                model.ErrorMessage = ex.Message;
                return View(model);
            }
            catch (Exception)
            {
                model.IsValid = false;
                model.ErrorMessage = Strings.ErrorOccured;
                return View(model);
            }

            return RedirectToAction("Index", "Video");
        }