public async Task AssignToAsync(Issue issue, AppUser user) { var openIssueCount = await _issueRepository.CountAsync(issue => issue.AssignedUserId == user.Id && !issue.IsClosed); if (openIssueCount >= MaxAllowedOpenIssuesForAUser) { throw new BusinessException(code: "IM:00392", message: $"You cannot assign more than {MaxAllowedOpenIssuesForAUser} issues to a user!"); } issue.AssignedUserId = user.Id; }