public IHttpActionResult GetParentReport(int parentId) { var userData = IdentityHelper.GetLoggedInUser(RequestContext); logger.Info("Get Parent report for {@parentId} by {@userData}", parentId, userData); if (parentId != userData.UserId && userData.UserRole == "parents") { throw new UnauthorizedAccessException("You are not allowed to access other parents data"); } return(Ok(service.GetParentReport(parentId))); }