private string CreateProfile(ProfileExportRequest request)
        {
            List <TestCase> testCases = new List <TestCase>();

            var configurationNode = StoragePool.GetKnownNode(KnownStorageNodeNames.Configuration);

            var testSuite = GetTestSuite(request.TestSuiteId);

            using (ProfileUtil profile = ProfileUtil.CreateProfile(
                       request.FileName, testSuite.Name, testSuite.Version))
            {
                string configBasePath    = GetConfigurationsPath(request.ConfigurationId, configurationNode.AbsolutePath);
                string profileSourceFile = Path.Combine(configBasePath, ConfigurationConsts.Profile);

                ProfileUtil.FileToStream(profileSourceFile, profile.ProfileStream);

                string ptfConfigSourceDir = GetPtfConfigBasePath(request.ConfigurationId, configurationNode.AbsolutePath);

                string[] ptfConfigFiles = Directory.GetFiles(ptfConfigSourceDir, "*.ptfconfig", SearchOption.TopDirectoryOnly);

                foreach (string settingsConfigFile in ptfConfigFiles)
                {
                    profile.AddPtfCfg(settingsConfigFile);
                }


                if (request.SelectedTestCases != null)
                {
                    foreach (var testCaseName in request.SelectedTestCases)
                    {
                        var testCase = new TestCase()
                        {
                            FullName  = testCaseName,
                            IsChecked = true
                        };

                        testCases.Add(testCase);
                    }
                }

                ExportPlaylist(profile.PlaylistStream, true, request.TestResultId, testCases);
            }

            return(request.FileName);
        }