public async Task <ICommandResult> Handle(TemplateChangeCommand message) { try { ICommandResult result; RTemplate rTemplate = await _templateService.GetById(message.Id); if (rTemplate == null) { result = new CommandResult() { Message = "Template not found", ObjectId = "", Status = CommandResult.StatusEnum.Fail, ResourceName = ResourceKey.Template_NotFound }; return(result); } RTemplateConfig[] rTemplateConfigs = await _templateService.GetTemplateConfigByTemplateId(rTemplate.Id); Template template = new Template(rTemplate, rTemplateConfigs); template.Change(message); await _templateService.Change(template); await _eventSender.Notify(template.Events); result = new CommandResult() { Message = "", ObjectId = template.Id, Status = CommandResult.StatusEnum.Sucess }; return(result); } catch (Exception e) { e.Data["Param"] = message; ICommandResult result = new CommandResult() { Message = e.Message, Status = CommandResult.StatusEnum.Fail }; return(result); } }