private string GetGroupName() { var departments = new List <string> { "machining", "finishing", "assembly" }; var department = TagName.Split('.')[0]; var mid = TagName.Split('.')[1]; return(departments.Contains(department.ToLower()) ? mid.Substring(0, 2) : mid); }