private int?_ccrLookup(string inString, int rowIdx)
 {
     if (inString != null)
     {
         var inString_clean = inString.TrimStart("CC ".ToCharArray()).Replace("-", " ");
         int?licenseId      = _contextObs.ImageLicense.Where(img => EF.Functions.Like(img.LicenseName.Replace("-", " "), $"%{inString_clean}%")).Select(img => img.LicenseId).FirstOrDefault();
         if (licenseId == 0)
         {
             //not in db - valid format?
             if (Regex.IsMatch(inString, _ccrRegex))
             {
                 //TODO LocalisationJson??
                 var ccrLink = worksheetImages.Cells[rowIdx, ccrLinkCol].Value?.ToString().Trim();
                 if (Regex.IsMatch(inString, _ccUrlRegex))
                 {
                     ImageLicense imgLic = new ImageLicense();
                     imgLic.LicenseName = inString;
                     imgLic.LicenseLink = ccrLink;
                     licenseId          = _saveImageLicense(imgLic);
                     if (licenseId == null)
                     {
                         return(null);
                     }
                 }
             }
         }
         return(licenseId);
     }
     return(null);
 }
 public int _saveImageLicense(ImageLicense imgLic)
 {
     try
     {
         Logger.Debug("Saving new" + imgLic.LicenseName + " to Context");
         _contextObs.Add(imgLic);
         _contextObs.SaveChanges();
         Logger.Debug(".. Saved to Context");
         licenseImportCounter++;
         return(imgLic.LicenseId);
     }
     catch (Exception e)
     {
         Logger.Error(e.InnerException, "Error Adding ImageLicense to Context");
         return(0);
     }
 }