/// <summary>
        /// Adds a resource to the Localization Table
        /// </summary>
        /// <param name="key"></param>
        /// <param name="value"></param>
        /// <param name="languageID"></param>
        /// <param name="route"></param>
        /// <param name="type"></param>
        public int AddResource(string key, string value, int languageID, string route, ResourceType type)
        {
            using (var entities = new ResourceDB())
            {
                var lan = (from l in entities.Languages where l.ID == languageID select l).FirstOrDefault();

                var res = new Resource
                              {
                                  Key = key,
                                  Route = route,
                                  Value = value,
                                  Language = lan,
                                  ResourceType = type,
                                  CreationDate = DateTime.Now
                              };

                entities.Resources.Add(res);
                return entities.SaveChanges();
            }
        }
 private static object ConvertDbResource(Resource resource)
 {
     if (resource.ResourceType == ResourceType.Html)
     {
         return new MvcHtmlString(resource.Value);
     }
     return resource.Value;
 }