private static void ThrowExceptionIfUserLoginIsInvalid(UserLogin userLogin) { if (!userLogin.GetBrokenRules().Any()) { return; } var brokenRules = new StringBuilder(); brokenRules.AppendLine("There were problems saving the user login:"); foreach (var businessRule in userLogin.GetBrokenRules()) { brokenRules.AppendLine(businessRule.Rule); } throw new ApplicationException(brokenRules.ToString()); }