public async Task <ActionResult> Details(string id)
        {
            return(await Task.Run <ActionResult>(() =>
            {
                var candidateId = GetCandidateId();

                string searchReturnUrl = ViewBag.SearchReturnUrl != null ? ViewBag.SearchReturnUrl.ToString() : null;

                var response = _traineeshipSearchMediator.Details(id, candidateId, searchReturnUrl);

                switch (response.Code)
                {
                case TraineeshipSearchMediatorCodes.Details.VacancyNotFound:
                    return new TraineeshipNotFoundResult();

                case TraineeshipSearchMediatorCodes.Details.VacancyHasError:
                    ModelState.Clear();
                    SetUserMessage(response.Message.Text, response.Message.Level);
                    return View(response.ViewModel);

                case TraineeshipSearchMediatorCodes.Details.Ok:
                    return View(response.ViewModel);
                }

                throw new InvalidMediatorCodeException(response.Code);
            }));
        }
        public async Task <ActionResult> Details(string id)
        {
            return(await Task.Run(() =>
            {
                var candidateId = GetCandidateId();

                var response = _traineeshipSearchMediator.Details(id, candidateId);

                return GetDetailsResult(response);
            }));
        }