public async Task <ResponseWrapper <SetActive> > Handle(Command request, CancellationToken cancellationToken) { try { var dish = await _context.Get(request.Id); if (dish == null) { throw new RestException(HttpStatusCode.NotFound, "No dish found with this Id"); } await _context.ChangeActiveState(request.Id, request.Active); var responseWrapper = ResponseWrapper <SetActive> .GetInstance((int)HttpStatusCode.OK, null, true, null); return(responseWrapper); } catch (Exception ex) { _logger.LogError(ex, "Problem setting the active status of the dish"); throw new Exception("Problem setting the active status of the dish"); } }