/// <summary>
        /// Gets a list of public ingredients by type
        /// </summary>
        public IList <TIngredient> GetPublicIngredients <TIngredient>() where TIngredient : class, IIngredient
        {
            var cacheKey = string.Concat("Public", typeof(TIngredient).Name, "s");

            var func = new Func <IList <TIngredient> >(() => this.Repository.GetSet <TIngredient>()
                                                       .Where(x => x.IsActive)
                                                       .Where(x => x.IsPublic)
                                                       .OrderBy(x => x.Name)
                                                       .ToList());

            return(this.CachingService.Get(cacheKey,
                                           SlidingCacheExpirationSettings.Make(20, CacheItemPriority.High), func));
        }
        /// <summary>
        /// Gets Ingredient Categories
        /// </summary>
        public IList <IngredientCategory> GetIngredientCategories()
        {
            var func = new Func <IList <IngredientCategory> >(() =>
            {
                return(this.Repository.GetSet <IngredientCategory>()
                       .OrderBy(x => x.IngredientTypeId)
                       .ThenBy(x => x.Rank)
                       .ToList());
            });

            return(this.CachingService.Get("IngredientCategories",
                                           SlidingCacheExpirationSettings.Make(20, CacheItemPriority.High), func));
        }
        /// <summary>
        /// Gets content text by short name
        /// </summary>
        public string GetContentTextByShortName(string shortName, bool forceActive = false, bool forcePublic = false, bool cacheResult = false)
        {
            var func = new Func <string>(() =>
            {
                var query = this.Repository.GetSet <Content>()
                            .Where(x => x.ShortName == shortName);

                this.ApplyContentFilter(query, forceActive, forcePublic);

                return(query.Select(x => x.Text).FirstOrDefault());
            });

            return(cacheResult ? this.CachingService.Get("CONTENTTEXT_" + shortName,
                                                         SlidingCacheExpirationSettings.Make(15, CacheItemPriority.Normal), func)
                                : func());
        }
        /// <summary>
        /// Gets a content entry by Id
        /// </summary>
        public Content GetContentById(int contentId, bool forceActive = false, bool forcePublic = false, bool cacheResult = false)
        {
            var func = new Func <Content>(() =>
            {
                var query = this.Repository.GetSet <Content>()
                            .Where(x => x.ContentId == contentId);

                this.ApplyContentFilter(query, forceActive, forcePublic);

                return(query.FirstOrDefault());
            });

            return(cacheResult ? this.CachingService.Get("CONTENT_" + contentId,
                                                         SlidingCacheExpirationSettings.Make(15, CacheItemPriority.Normal), func)
                                : func());
        }