protected async Task <ActionResult <T> > Execute <T>(Func <IOperation, Task <T> > action, [CallerMemberName] string callerName = "")
 {
     try
     {
         var operationContext = OperationContext.Builder().SetName(GetType().FullName, callerName).SetUserId(UserId).Create();
         return(await operationService.Make(operationContext, action));
     }
     catch (BadRequestException e)
     {
         return(ApiControllerUtils.HandleException(BadRequest, e));
     }
     catch (NotFoundException e)
     {
         return(ApiControllerUtils.HandleException(NotFound, e));
     }
     catch (AuthenticationException e) when(e.StatusCode == StatusCodes.Status401Unauthorized)
     {
         return(ApiControllerUtils.HandleException(Unauthorized, e));
     }
     catch (AuthenticationException e) when(e.StatusCode == StatusCodes.Status403Forbidden)
     {
         return(ApiControllerUtils.HandleException(ApiControllerUtils.Forbidden, e));
     }
     catch (OperationException e)
     {
         return(ApiControllerUtils.HandleException(BadRequest, e));
     }
     catch (Exception e)
     {
         return(ApiControllerUtils.HandleException(ApiControllerUtils.InternalServerError, e));
     }
 }
        public async Task OnAuthorizationAsync(AuthorizationFilterContext context)
        {
            var operationContext = OperationContext.Builder()
                                   .SetName(GetType().FullName, "OnAuthorization")
                                   .SetUserId(null, true)
                                   .Create();

            try
            {
                await operationService.Make(operationContext, async operation => await ValidateToken(context, operation));
            }
            catch (AuthenticationException e) when(e.StatusCode == StatusCodes.Status401Unauthorized)
            {
                context.Result = ApiControllerUtils.HandleException(result => new UnauthorizedObjectResult(result), e);
            }
            catch (AuthenticationException e) when(e.StatusCode == StatusCodes.Status403Forbidden)
            {
                context.Result = ApiControllerUtils.HandleException(ApiControllerUtils.Forbidden, e);
            }
            catch (Exception e)
            {
                context.Result = ApiControllerUtils.HandleException(ApiControllerUtils.InternalServerError, e);
            }
        }