public ValidationResultItem SetValue(object entity, ExcelRange cell) { string cellValue = cell.GetValue <string>(); if (string.IsNullOrEmpty(cellValue)) { Property.SetValue(entity, null); } else { List <string> valueNames = new List <string>(); foreach (TEnum value in Enum.GetValues(typeof(TEnum))) { valueNames.Add(value.ToString()); } var keys = TranslationProvider.GetKeysByTranslation(cellValue); keys = keys.Select(x => x.ToLower()); string validCellValue = keys.FirstOrDefault(x => valueNames.Any(y => string.Compare(x, y, true) == 0)); if (string.IsNullOrEmpty(validCellValue)) { string lowerCellValue = cellValue.ToLower(); validCellValue = valueNames.FirstOrDefault(n => n.ToLower() == lowerCellValue); } Property.SetValue(entity, new LookUpDto(validCellValue)); } return(null); }