public USDConfiguration GetUSDConfiguration(CrmServiceClient crmService, string configurationName) { CRMEntity configurationCE = _configurationRepository.GetConfigurationEntity(crmService, configurationName); if (configurationCE == null) { return(null); } AddToCollection(configurationCE); EntityReference configurationER = configurationCE.CRMRecords[0].ToEntityReference(); CRMEntity hostedControlsCE = _hostedControlRepository.GetHostedControls(crmService, configurationER); AddToCollection(hostedControlsCE); CRMEntity entityTypesCE = _entityTypeRepository.GetEntityTypes(crmService); AddToCollection(entityTypesCE); CRMEntity eventsCE = _eventrepository.GetEvents(crmService, configurationER); AddToCollection(eventsCE); CRMEntity scriptletsCE = _scriptletRepository.GetScriptlets(crmService, configurationER); AddToCollection(scriptletsCE); CRMEntity entitySearchesCE = _entitySearchRepository.GetEntitySearches(crmService, configurationER); AddToCollection(entitySearchesCE); CRMEntity sessionLinesCE = _sessionLineRepository.GetSessionLines(crmService, configurationER); AddToCollection(sessionLinesCE); CRMEntity optionCE = _optionRepository.GetOptions(crmService, configurationER); AddToCollection(optionCE); CRMEntity actionCE = _actionRepository.GetActions(crmService, configurationER); AddToCollection(actionCE); CRMEntity actionCallCE = _actionCallrepository.GetActionCalls(crmService, configurationER); AddToCollection(actionCallCE); CRMEntity subActionCallsCE = _subActionCallsRepository.GetSubActionCalls(crmService, actionCallCE); AddToCollection(subActionCallsCE); CRMEntity eventActionCallsCE = _eventActionCallRepository.GetEventActionCalls(crmService, eventsCE, actionCallCE); AddToCollection(eventActionCallsCE); CRMEntity toolbarsCE = _toolbarRepository.GetToolbars(crmService, configurationER); AddToCollection(toolbarsCE); CRMEntity toolbarButtonsCE = _toolbarButtonRepository.GetToolbarButtons(crmService, configurationER); AddToCollection(toolbarButtonsCE); CRMEntity toolbarButtonActionCallsCE = _toolbarButtonActionCallRepository.GetToolbarButtonActionCalls(crmService, toolbarButtonsCE, actionCallCE); AddToCollection(toolbarButtonActionCallsCE); CRMEntity toolbarHostedControlsCE = _toolbarHostedControlRepository.GetToolbarHostedControls(crmService, toolbarsCE, hostedControlsCE); AddToCollection(toolbarHostedControlsCE); CRMEntity windowNavigationRulesCE = _wnrRepository.GetWindowNavigationRules(crmService, configurationER); AddToCollection(windowNavigationRulesCE); CRMEntity navigationRulesActionCallsCE = _wnrActionCallrepository.GetWNRActionCalls(crmService, windowNavigationRulesCE, actionCallCE); AddToCollection(navigationRulesActionCallsCE); CRMEntity agentScriptTasksCE = _agentScriptTaskRepository.GetAgentScriptTasks(crmService, configurationER); AddToCollection(agentScriptTasksCE); CRMEntity taskActionCallsCE = _taskActionCallRepository.GetTaskActionCalls(crmService, agentScriptTasksCE, actionCallCE); AddToCollection(taskActionCallsCE); CRMEntity taskAnswersCE = _taskAnswerRepository.GetTaskAnswers(crmService, agentScriptTasksCE); AddToCollection(taskAnswersCE); CRMEntity agentScriptAnswersCE = _agentScriptAnswerRepository.GetAgentScriptAnswers(crmService, taskAnswersCE); AddToCollection(agentScriptAnswersCE); CRMEntity answerActionCallsCE = _answerActionCallRepository.GetAnswerActionCalls(crmService, agentScriptAnswersCE, actionCallCE); AddToCollection(answerActionCallsCE); USDConfiguration usdConfiguration = new USDConfiguration { CRMEntities = _crmEntities, Name = configurationName }; return(usdConfiguration); }