public static SponsorDataModel ToModel(this SponsorData sponsorData, IMediaService mediaService)
        {
            if (sponsorData == null)
                return new SponsorDataModel();
            var model = new SponsorDataModel()
            {
                Id = sponsorData.Id,
                BattleType = sponsorData.BattleType,
                BattleId = sponsorData.BattleId,
                SponsorCustomerId = sponsorData.SponsorCustomerId,
                PictureId = sponsorData.PictureId,
                DisplayName = sponsorData.DisplayName,
                TargetUrl = sponsorData.TargetUrl,
                DisplayOrder = sponsorData.DisplayOrder
            };
            if (sponsorData.PictureId > 0)
                model.PictureUrl = mediaService.GetPictureUrl(model.PictureId);

            return model;
        }
        public IHttpActionResult SaveSponsorData(SponsorDataModel requestModel)
        {
            //here we update or reject the status of battle
            if (!ModelState.IsValid)
                return Json(new { Success = false, Message = "Invalid Data" });

            //because a sponsor may have performed multiple transactions for a battle, we'd update all of them at once

            //first get the battle
            //TODO: Remove comment when picture battles are ready
            var battle = _videoBattleService.Get(requestModel.BattleId); // Model.BattleType == BattleType.Video ? _videoBattleService.GetById(Model.BattleId) : null;

            //first get battle
            var videoBattle = _videoBattleService.Get(requestModel.BattleId);
            var sponsors = _sponsorService.GetSponsors(ApplicationContext.Current.CurrentUser.Id, requestModel.BattleId, BattleType.Video,
                SponsorshipStatus.Accepted);
            //only the battle owner or the sponsor can save the sponsor data
            if (!(sponsors.Any() || videoBattle.ChallengerId == ApplicationContext.Current.CurrentUser.Id))
                return Json(new { Success = false, Message = "Unauthorized" });

            //get the sponsor data. Because battle owner can also save the data, we need to make sure that correct data is requested
            //because battle owner can save anybody's data while sponsor can save only his or her data
            var sponsorData = _sponsorService.GetSponsorData(requestModel.BattleId, requestModel.BattleType, sponsors.Any() ? ApplicationContext.Current.CurrentUser.Id : requestModel.SponsorCustomerId);
            sponsorData.DisplayName = requestModel.DisplayName;
            sponsorData.PictureId = requestModel.PictureId;
            sponsorData.TargetUrl = requestModel.TargetUrl;
            sponsorData.DateUpdated = DateTime.UtcNow;

            //display order can only be changed by battle owner depending on the amount or his choice
            if (videoBattle.ChallengerId == ApplicationContext.Current.CurrentUser.Id)
                sponsorData.DisplayOrder = requestModel.DisplayOrder;

            _sponsorService.SaveSponsorData(sponsorData);

            return Json(new { Success = true });
        }