public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
        {
            int id = 0;

            if (context.ActionArguments.ContainsKey("id"))
            {
                id = (int)context.ActionArguments["id"];
            }
            else
            {
                context.Result = new BadRequestObjectResult("Bad Id parameter");
                return;
            }
            IRepositoryBase <T> repo = _repo.GetRepo <T>();

            if (repo == null)
            {
                context.Result = new BadRequestObjectResult("Error");
                return;
            }
            var entity = await repo.FindByCondition(x => x.Id == id).FirstOrDefaultAsync();

            if (entity == null)
            {
                _logger.LogError(LogMessage.NotFound(typeof(T).Name, id));
                context.Result = new NotFoundResult();
                return;
            }
            else
            {
                context.HttpContext.Items.Add("entity", entity);
            }
            await next();
        }