public async Task <InvokeResult> PopulateRoutes(Route route, EntityHeader org, EntityHeader user)
        {
            var fullLoadResult = new InvokeResult();

            var msgLoadResult = await _deviceMessageDefinitionManager.LoadFullDeviceMessageDefinitionAsync(route.MessageDefinition.Id, org, user);

            if (msgLoadResult.Successful)
            {
                route.MessageDefinition.Value = msgLoadResult.Result;
            }
            else
            {
                fullLoadResult.Concat(fullLoadResult);
            }

            foreach (var module in route.PipelineModules)
            {
                switch (module.ModuleType.Value)
                {
                case Pipeline.Admin.Models.PipelineModuleType.InputTranslator:
                {
                    var result = await _pipelineModuleManager.LoadFullInputTranslatorConfigurationAsync(module.Module.Id);

                    if (result.Successful)
                    {
                        module.Module.Value = result.Result;
                    }
                    else
                    {
                        fullLoadResult.Concat(result);
                    }
                }
                break;

                case Pipeline.Admin.Models.PipelineModuleType.DataStream:
                {
                    var result = await _dataStreamManager.LoadFullDataStreamConfigurationAsync(module.Module.Id);

                    if (result.Successful)
                    {
                        module.Module.Value = result.Result;
                    }
                    else
                    {
                        fullLoadResult.Concat(result);
                    }
                }
                break;

                case Pipeline.Admin.Models.PipelineModuleType.Sentinel:
                {
                    var result = await _pipelineModuleManager.LoadFullSentinelConfigurationAsync(module.Module.Id);

                    if (result.Successful)
                    {
                        module.Module.Value = result.Result;
                    }
                    else
                    {
                        fullLoadResult.Concat(result);
                    }
                }
                break;

                case Pipeline.Admin.Models.PipelineModuleType.Workflow:
                {
                    var result = await _deviceAdminManager.LoadFullDeviceWorkflowAsync(module.Module.Id, org, user);

                    if (result.Successful)
                    {
                        module.Module.Value = result.Result;
                        var destModuleConfig = route.PipelineModules.Where(mod => mod.Id == module.PrimaryOutput.Id).FirstOrDefault();

                        if (destModuleConfig.ModuleType.Value == Pipeline.Admin.Models.PipelineModuleType.OutputTranslator)
                        {
                            if (module.PrimaryOutput != null && module.PrimaryOutput.Mappings != null)
                            {
                                for (var idx = 0; idx < module.PrimaryOutput.Mappings.Count; ++idx)
                                {
                                    var mapping = module.PrimaryOutput.Mappings[idx];
                                    if (mapping.Value != null)
                                    {
                                        var mappingValue = JsonConvert.DeserializeObject <OutputCommandMapping>(mapping.Value.ToString());
                                        if (mappingValue != null && !EntityHeader.IsNullOrEmpty(mappingValue.OutgoingDeviceMessage))
                                        {
                                            var outgoingMsgLoadResult = await _deviceMessageDefinitionManager.LoadFullDeviceMessageDefinitionAsync(mappingValue.OutgoingDeviceMessage.Id, org, user);

                                            mappingValue.OutgoingDeviceMessage.Value = outgoingMsgLoadResult.Result;
                                            module.PrimaryOutput.Mappings[idx]       = new KeyValuePair <string, object>(mapping.Key, mappingValue);
                                        }
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        fullLoadResult.Concat(result);
                    }
                }
                break;

                case Pipeline.Admin.Models.PipelineModuleType.OutputTranslator:
                {
                    var result = await _pipelineModuleManager.LoadFullOutputTranslatorConfigurationAsync(module.Module.Id);

                    if (result.Successful)
                    {
                        module.Module.Value = result.Result;
                    }
                    else
                    {
                        fullLoadResult.Concat(result);
                    }
                }
                break;

                case Pipeline.Admin.Models.PipelineModuleType.Transmitter:
                {
                    var result = await _pipelineModuleManager.LoadFullTransmitterConfigurationAsync(module.Module.Id);

                    if (result.Successful)
                    {
                        module.Module.Value = result.Result;
                    }
                    else
                    {
                        fullLoadResult.Concat(result);
                    }
                }
                break;

                case Pipeline.Admin.Models.PipelineModuleType.Custom:
                {
                    var result = await _pipelineModuleManager.LoadFullCustomPipelineModuleConfigurationAsync(module.Module.Id);

                    if (result.Successful)
                    {
                        module.Module.Value = result.Result;
                    }
                    else
                    {
                        fullLoadResult.Concat(result);
                    }
                }
                break;
                }
            }

            return(fullLoadResult);
        }