private static string GetDomain(string userName) { return userName.Contains('\\') ? userName.Substring(0, userName.IndexOf('\\')) : null; }