public JsonResult Save(HeroModel model, IEnumerable<HttpPostedFileBase> images) 
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var hero = new Hero();
                    var photos = new List<IPostedFile>();
                    Mapper.Map(model, hero);

                    if (!images.IsNullOrEmpty())
                    {
                        foreach (var image in images)
                        {
                            if (image.ContentLength > 0)
                            {
                                var file = new PostedFile(image);
                                if (image.FileName.Equals(model.Thumbnail, StringComparison.OrdinalIgnoreCase))
                                {
                                    file.Attributes.Add("IsThumbnail", "1");
                                }
                                file.Attributes.Add("FileName", string.Concat(Guid.NewGuid(), Path.GetExtension(image.FileName)));
                                photos.Add(file);
                            }
                        }
                    }
                    hero.UpdatedBy = AppUser.UserId;
                    if (model.IsNew)
                    {
                        hero.LanguageId = AppUser.LanguageId;
                        hero.HeroId = _heroRepository.CreateHero(hero, photos);
                    }
                    else
                    {
                        _heroRepository.UpdateHero(hero, photos);
                    }
                    return Json(new { Ok = true, HeroId = hero.HeroId });
                }
                catch (Exception)
                {                    
                }
            }
            return Json(new {Ok = false});
        }
        //[Authorize2(Roles = "Admin")]
        public PartialViewResult Edit(int? id)
        {
            var model = new HeroModel();
            if (id.HasValue)
            {
                var hero = _heroRepository.GetHero(id.Value, AppUser.LanguageId);
                Mapper.Map(hero, model);
            }
            var languages = _metadataRepository.GetLanguages();
            var groups = _metadataRepository.GetMilitaryGroups(AppUser.LanguageId);
            var ranks = _metadataRepository.GetMilitaryRanks(AppUser.LanguageId);
            var awards = _metadataRepository.GetMilitaryAwards(AppUser.LanguageId);

            model.Languages = new SelectList(languages, "LanguageId", "DisplayName", model.LanguageId);
            model.MilitaryGroups = new SelectList(groups, "MilitaryGroupId", "GroupName", model.MilitaryGroupId);
            model.MilitaryRanks = new SelectList(ranks, "MilitaryRankId", "RankName", model.MilitaryRankId);
            model.MilitaryAwards = new SelectList(awards, "MilitaryAwardId", "AwardName", model.MilitaryAwardId);

            return PartialView("EditPartial", model);
        }