public async Task <ICommandResult> Handle(CreateCallCommand command) { NameOrDescription title = new NameOrDescription(command.Title); CompanyAndBranchOffice companyAndBranchOffice = new CompanyAndBranchOffice(command.CompanyId, command.BranchOfficeId); Call call = new Call( command.CallTypeId, command.CallGroupId, command.CustomerId, command.SectorId, command.ContractId, command.EmployeeId, command.Priority, title, command.Details, command.CreatedByUserId, companyAndBranchOffice, command.MachineNameOrIP); AddNotifications(title.Notifications); AddNotifications(call.Notifications); if (!Valid) { return(new CommandResult( false, Messages.NOTIFICATIONS, Notifications)); } await _CallRepository.Create(call); return(new CommandResult( true, Messages.RECORDED_WITH_SUCCESS, new CallCommandResult { Id = call.Id, CallTypeId = call.CallTypeId, CallGroupId = call.CallGroupId, CustomerId = call.CustomerId, SectorId = call.SectorId, ContractId = call.ContractId, EmployeeId = call.EmployeeId, Priority = call.Priority, Title = call.Title.Name, Details = call.Details, Status = call.Status, CreatedDate = call.Audit.CreatedDateBy.CreatedDate, CreatedByUserId = call.Audit.CreatedDateBy.CreatedByUserId, UpdatedDate = call.Audit.UpdatedDateBy.UpdatedDate, UpdatedByUserId = call.Audit.UpdatedDateBy.UpdatedByUserId, CompanyId = call.Audit.CompanyAndBranchOffice.CompanyId, BranchOfficeId = call.Audit.CompanyAndBranchOffice.BranchOfficeId, MachineNameOrIP = call.Audit.MachineNameOrIP })); }