public async Task <IActionResult> AddOrChange([FromBody] MenuAddOrChangeRequest request)
 {
     try
     {
         MenuAddOrChangeResponse response = new MenuAddOrChangeResponse();
         var results = MenuAddOrChangeRequestValidator.ValidateModel(request);
         if (results.IsValid)
         {
             results = MenuModelAddModelValidator.ValidateModel(request.Menu);
             if (results.IsValid)
             {
                 response = await _menuAppService.MenuAddOrChange(request);
             }
             else
             {
                 response.SetFail(results.Errors.Select(p => p.ToString()));
             }
         }
         else
         {
             response.SetFail(results.Errors.Select(p => p.ToString()));
         }
         return(Json(response));
     }
     catch (Exception e)
     {
         _logger.LogError(e, Common.Common.GetMethodName(), request);
         throw;
     }
 }
        public async Task <MenuAddOrChangeResponse> MenuAddOrChange(MenuAddOrChangeRequest request)
        {
            MenuAddOrChangeResponse response = new MenuAddOrChangeResponse();

            try
            {
                if (string.IsNullOrEmpty(request.Menu.Id))
                {
                    var command = request.Menu.ToAddCommand();
                    var result  = await _menuService.SendCommand(command);

                    if (result.IsSucess)
                    {
                        response.SetSucess();
                    }
                    else
                    {
                        response.SetFail(result.Message);
                    }
                }
                else
                {
                    var command = request.Menu.ToChangeCommand(request.Menu.Version);
                    var result  = await _menuService.SendCommand(command);

                    if (result.IsSucess)
                    {
                        response.SetSucess();
                    }
                    else
                    {
                        response.SetFail(result.Message);
                    }
                }
            }
            catch (Exception e)
            {
                response.SetFail(e);
                _logger.LogError(e, e.Message, request);
            }
            return(response);
        }