public async Task <ActionResult> Login(LoginViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(PartialView(model));
            }

            var apiModel        = _mapper.Map <LoginViewModel, LoginApiModel>(model);
            var responseMessage = await _loginClient.TryAuthorize(apiModel);

            if (!responseMessage.IsSuccessStatusCode)
            {
                ClearAndAddModelError("The username or password is incorrect");
                return(PartialView(model));
            }
            var tokenResponse = await _loginClient.GetTokenResponse(responseMessage);

            AddTokenToSession(tokenResponse.AccessToken);
            return(JavaScript("window.location = '/Measurements/AllMeasurements'"));
        }