/// <summary>
        /// Filters items in the ContentItems table and returns only Log-In Alerts.
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        private static List <ContentItem> GetContentItems(GetContentItemRequest request)
        {
            var currentSite        = GetContentSites(request.SiteDescription).FirstOrDefault().SiteID.ToString().ToUpper();
            var currentEnvironment = GetCurrentContentEnvironment().EnvironmentID.ToString().ToUpper();

            // Establish the base query
            var query = "SELECT";

            query += " ContentItemID, SiteID, ViewID, ContentDescription, CountryID, LanguageID, ValidFrom, ExpirationDate, EnvironmentID";
            query += " FROM ExigoWebContext.ContentItems";

            if (!request.GetAllAlerts)
            {
                query += " Where ";
                query += " ValidFrom <= GETDATE()";
                query += " And ";
                query += " (ExpirationDate >= GETDATE() Or ExpirationDate IS NULL)";

                if (request.ContentItemIDs != null)
                {
                    query += " And ";
                    query += " ContentItemID in @contentitemid";
                }

                if (request.GetAlert)
                {
                    query += " And ";
                    query += " ViewID = 'Alert' ";
                }
            }
            else
            {
                query += " Where ";
                query += " ViewID = 'Alert' ";
            }

            query += " And ";
            query += " EnvironmentID = @contentenvironment";
            query += " And ";
            query += " SiteID = @contentsite";
            query += " ORDER BY ValidFrom DESC";

            var model = new List <ContentItem>();

            using (var context = ExigoDAL.Sql())
            {
                model = context.Query <ContentItem>(query, new { contentenvironment = currentEnvironment, contentsite = currentSite, contentitemid = request.ContentItemIDs }).ToList();
            }
            return(model);
        }
 /// <summary>
 /// Gets content from the ContentItemCountryLanguages table according user location/language.
 /// </summary>
 /// <param name="request"></param>
 public static List <ContentItem> GetContentBlock(GetContentItemRequest request)
 {
     return(ContentService.GetContentItems(request));
 }
 /// <summary>
 /// Retreives alert from ContentItem database table.
 /// </summary>
 /// <param name="content"></param>
 /// <returns></returns>
 public static List <ContentItem> GetAlert(GetContentItemRequest content)
 {
     return(ContentService.GetContentItems(content));
 }