private BllPost GetAd(ref int imagesOnPage) { BllPost ad; AdHelper.Initialize(_postService.GetAllWithAd()); if (User.Identity.IsAuthenticated) { var user = _accountService.GetUserByLogin(User.Identity.Name); var disabledAds = _postService.GetDisabledAds(user.UserId).ToList(); ad = AdHelper.GetAd(disabledAds, user.AgeId, user.SexId, user.CountryId, user.LanguageId); imagesOnPage -= 1; } else { ad = AdHelper.GetRandomAd(); } return(ad); }