private void CheckCreateOrUpdateArguments(User user) { var otherWithUserName = _getUserByUsernameQuery.Execute(user.UserName); var otherWithEmail = _getUserByEmailQuery.Execute(user.EmailAddress); if (otherWithEmail != null || otherWithUserName != null) { var ex = new ApplicationValidationException(); if(otherWithUserName != null) { ex.AddError("UserName", "The user name selected is not available."); } if(otherWithEmail != null) { ex.AddError("EmailAddress", "The email address selected is not available."); } throw ex; } }