/// <summary>
        /// Saves to database. If culture is present, Translation entry is saved
        /// </summary>
        /// <param name="session"></param>
        /// <param name="input"></param>
        private void SaveStringToDatabase(ISession session, StringEntry input, bool overwrite)
        {
            var translatableString =
              (from s in session.Linq<LocalizableStringRecord>()
               where s.StringKey == input.Key
              && s.Context == input.Context
               select s).FirstOrDefault();
              if (translatableString == null)
              {
            string path = input.Path;
            if (!path.Contains("{0}") && !string.IsNullOrEmpty(input.Culture))
              path = path.Replace(input.Culture, "{0}");
            translatableString = new LocalizableStringRecord
            {
              Path = path,
              Context = input.Context,
              StringKey = input.Key,
              OriginalLanguageString = input.English
            };
            if (!translatableString.Path.Contains("{0}"))
              throw new Exception("Path should contain {0}, but doesn't.\n" + translatableString.Path);
            session.SaveOrUpdate(translatableString);
              }
              else if (translatableString.OriginalLanguageString != input.English)
              {
            translatableString.OriginalLanguageString = input.English;
            session.SaveOrUpdate(translatableString);
              }

              if (!string.IsNullOrEmpty(input.Culture) && !string.IsNullOrEmpty(input.Translation))
              {
            var translation =
            (from t in translatableString.Translations
             where t.Culture.Equals(input.Culture)
             select t).FirstOrDefault();

            if (translation == null)
            {
              translation = new TranslationRecord
            {
              Culture = input.Culture,
              Value = input.Translation
            };
              translatableString.AddTranslation(translation);
            }
            else if (overwrite)
            {
              translation.Value = input.Translation;
            }
            session.SaveOrUpdate(translatableString);
            session.SaveOrUpdate(translation);
              }

              SetCacheInvalid();
        }
 public ActionResult ManualAdd(LocalizableStringRecord record)
 {
     if (!Services.Authorizer.Authorize(Permissions.Translate))
     return new HttpUnauthorizedResult();
       //var rec2 = Repo.Fetch(c => true).First();
       if (String.IsNullOrWhiteSpace(record.Context) ||
     String.IsNullOrWhiteSpace(record.StringKey) ||
     String.IsNullOrWhiteSpace(record.Path))
       {
     Services.Notifier.Add(Orchard.UI.Notify.NotifyType.Error, T("Missing required information"));
       }
       else
       {
     record.OriginalLanguageString = record.StringKey;
     Repo.Create(record);
     Services.Notifier.Add(Orchard.UI.Notify.NotifyType.Information, T("Added 1 translation: {0}", record.OriginalLanguageString));
       }
       return RedirectToAction("Import");
 }