internal static User ValidateUser(Server server, string userName) { if (string.IsNullOrWhiteSpace(userName)) throw new ArgumentNullException(nameof(userName)); var user = server.FindUsers(userName).FirstOrDefault(); if (user == null) throw new NullReferenceException("That user does not exist."); return user; }