private static CategoryName GetCategory(LogEvent logEvent, Database db) { CategoryName category = CategoryName.OneWhere(cc => cc.Value == logEvent.Category, db); if (category == null) { category = new CategoryName(); category.Value = logEvent.Category; category.Save(db); } return(category); }