public Dictionary<int, bool> SiteRetensionTimeValues; // Count / IsSelected

        #endregion Fields

        #region Constructors

        public SiteSettingsViewModel()
        {
            using (var context = new DataContext())
            {
                Settings = context.SiteSettings.FirstOrDefault();

                // Set some initial values if none are found.
                if (Settings == null)
                {
                    Settings = new SiteSettings()
                    {
                        SearchIndex = true
                    };

                    context.SiteSettings.Add(Settings);

                    context.SaveChanges();
                }
            }

            SiteRetensionTimeValues = new Dictionary<int, bool>
                {
                    { 5, Settings.ContentPageRevisionsRetensionCount == 5 },
                    { 10, Settings.ContentPageRevisionsRetensionCount == 10 },
                    { 25, Settings.ContentPageRevisionsRetensionCount == 25 },
                    { 50, Settings.ContentPageRevisionsRetensionCount == 50 }
                };

            RolesList = Roles.GetAllRoles().ToList();
        }
        public JsonResult SiteSettings(SiteSettings entity)
        {
            var result = new JsonResult();

            using (var context = new DataContext())
            {
                var siteSettings = context.SiteSettings.FirstOrDefault();
                if (siteSettings != null)
                {
                    siteSettings.ContactEmail = entity.ContactEmail;
                    siteSettings.SearchIndex = entity.SearchIndex;
                    siteSettings.GoogleAnalyticsId = entity.GoogleAnalyticsId;
                    siteSettings.ContentPageRevisionsEnabled = entity.ContentPageRevisionsEnabled;
                    siteSettings.ContentPageRevisionsRetensionCount = entity.ContentPageRevisionsRetensionCount;
                    siteSettings.DefaultUserRole = entity.DefaultUserRole;

                    context.SaveChanges();
                }
            }

            return result;
        }