public ActionResult Experience(ExperienceModel model, IEnumerable<HttpPostedFileBase> files)
        {
            string error = String.Empty;
            string SPPath = AuthenticationService.CurrentUser.Id.ToString();

            if (model.RowID == 0)
            {
                if (ValidateModel(model))
                {
                    model.IsDraft = model.IsExpDraft;
                    EmploymentBl.ProcessSaving<ExperienceModel, Experience>(model, out error);
                    model = EmploymentBl.GetExperienceModel(model.UserId);
                    ViewBag.Error = error;
                    ModelState.AddModelError("IsValidate", string.IsNullOrEmpty(error) ? "Данные сохранены!" : error);
                }
                else
                {   //так как при использования вкладок, страницу приходится перезагружать с потерей данных, то передаем модель с библиотекой ошибок через переменную сессии

                    model = EmploymentBl.GetExperienceModel(model);
                    if (Session["ExperienceM" + SPPath] != null)
                        Session.Remove("ExperienceM" + SPPath);
                    if (Session["ExperienceM" + SPPath] == null)
                        Session.Add("ExperienceM" + SPPath, model);
                }
            }
            else
            {
                EmploymentBl.DeleteExperiensRow(model);
                model = EmploymentBl.GetExperienceModel(model.UserId);
            }

            if (Session["ExperienceMS" + SPPath] != null)
                Session.Remove("ExperienceMS" + SPPath);
            if (Session["ExperienceMS" + SPPath] == null)
            {
                ModelStateDictionary mst = ModelState;
                Session.Add("ExperienceMS" + SPPath, mst);
            }

            if ((AuthenticationService.CurrentUser.UserRole & UserRole.PersonnelManager) > 0 && EmploymentBl.IsUnlimitedEditAvailable())
                return Redirect("PersonnelInfo?id=" + model.UserId + "&IsCandidateInfoAvailable=true&IsBackgroundCheckAvailable=true&IsManagersAvailable=true&IsPersonalManagersAvailable=true&TabIndex=6");
            else
                return model.IsFinal && !EmploymentBl.IsUnlimitedEditAvailable() ? View("ExperienceReadOnly", model) : View(model);
        }
        protected bool ValidateModel(ExperienceModel model)
        {
            //чистим ошибки для полей из модальной формы
            ModelState.Remove("BeginningDate");
            ModelState.Remove("EndDate");
            ModelState.Remove("Company");
            ModelState.Remove("Position");
            ModelState.Remove("CompanyContacts");

            ValidateFileLength(model.WorkBookScanFile, "WorkBookScanFile", 20);
            ValidateFileLength(model.WorkBookSupplementScanFile, "WorkBookSupplementScanFile", 20);

            if (!model.IsExpDraft)
            {
                ModelState.Clear();

                //ExperienceModel mt = EmploymentBl.GetExperienceModel(model.UserId);
                //if (model.WorkBookScanFile == null && string.IsNullOrEmpty(mt.WorkBookScanAttachmentFilename))
                //{
                //    ModelState.AddModelError("WorkBookScanFile", "Не выбран файл скана трудовой книжки/заявления для загрузки!");
                //}

                //if (!string.IsNullOrEmpty(model.WorkBookSupplementSeries) || !string.IsNullOrEmpty(model.WorkBookSupplementNumber) || model.WorkBookSupplementDateOfIssue.HasValue)
                //{
                //    if (model.WorkBookSupplementScanFile == null && string.IsNullOrEmpty(mt.WorkBookSupplementScanAttachmentFilename))
                //    {
                //        ModelState.AddModelError("WorkBookSupplementScanFile", "Не выбран файл скана трудовой книжки/заявления для загрузки!");
                //    }
                //}

                if (!model.IsValidate)
                {
                    ModelState.AddModelError("IsValidate", "Подтвердите правильность предоставленных данных! Подтвердив правильность предоставленных данных, Вы не сможете больше вносить изменения в данную часть анкеты!");
                }
            }
            return ModelState.IsValid;
        }