/// <summary>
        /// Migrates the Wse Module and all referencing XTestSteps.
        /// </summary>
        /// <param name="objectToExecuteOn">Only WSE XTestSteps and XModules which are present under this object will be migrated.</param>
        public void Migrate(TCObject objectToExecuteOn)
        {
            var wseTestSteps = CommonUtilities.GetFilteredWseTestSteps(objectToExecuteOn, wseModule.TestSteps);

            if (!wseTestSteps.Any())
            {
                WseModuleParser wseParser = new WseModuleParser();
                wseParser.Parse(wseModule);
                FolderStructureHandler folderStructureHandler = new FolderStructureHandler();
                TCFolder apiModuleFolder = folderStructureHandler.CreateFolderForApiModules(wseModule);
                ApiModuleHandler.CreateApiModulePair(apiModuleFolder, wseModule.Name, wseParser);
            }
            else
            {
                foreach (var wseTestStep in wseTestSteps)
                {
                    WseTestStepParser wseTestStepParser = new WseTestStepParser();
                    wseTestStepParser.Parse(wseTestStep, new XmlPayloadParser());
                    (ApiModule requestApiModule, ApiModule responseApiModule) =
                        GetExistingOrCreateNewApiModulePair(objectToExecuteOn, wseTestStep, wseTestStepParser);

                    WseTestStepMigrator wseTestStepMigrator = new WseTestStepMigrator();
                    wseTestStepMigrator.Migrate(objectToExecuteOn,
                                                requestApiModule,
                                                responseApiModule,
                                                new XmlPayloadParser(),
                                                new XmlPayloadSetterFactory(),
                                                wseTestStep);
                }
            }
        }
        private (ApiModule requestApiModule, ApiModule responseApiModule) GetExistingOrCreateNewApiModulePair(
            TCObject objectToExecuteOn,
            XTestStep wseTestStep,
            IWseArtifactsParser wseParser)
        {
            ApiModule requestApiModule  = null;
            ApiModule responseApiModule = null;

            if (!IsModuleSearchCriteriaEmpty(wseParser))
            {
                (requestApiModule, responseApiModule) =
                    CommonUtilities.SearchExistingApiModule(objectToExecuteOn, wseParser, wseTestStep);
            }

            if (requestApiModule != null)
            {
                return(requestApiModule, responseApiModule);
            }

            FolderStructureHandler folderStructureHandler = new FolderStructureHandler();

            (TCFolder apiModuleFolder, string moduleName) =
                folderStructureHandler.CreateFolderForApiModules(objectToExecuteOn, wseTestStep, wseParser);
            return(ApiModuleHandler.CreateApiModulePair(apiModuleFolder, moduleName, wseParser));
        }