private static void convertSourceFilesToWorkWithPowerBI(string sourcePath, SourceControlOption option)
        {
            string filePath = Path.Combine(sourcePath, option.FileName);

            //if its a file that is deleted we dont need to convert the file
            if (option.DeleteFile)
            {
                return;
            }

            if (option.IsJsonFile)
            {
                //rename file if we have added an extension
                if (!string.IsNullOrWhiteSpace(option.AddFileExtension))
                {
                    var filePathWithExtension = filePath + option.AddFileExtension;
                    renameFile(filePathWithExtension, filePath);
                }

                //read in the file from the file system
                string  jsonString  = File.ReadAllText(filePath, Encoding.UTF8);
                JObject jsonObjects = JObject.Parse(jsonString);

                //restore layout file
                if (option.FileName == "Report\\Layout")
                {
                    string layoutStorageLocation = Path.Combine(sourcePath, "Report", "LayoutFiles");
                    LayoutUtil.WriteLayouts(jsonObjects, layoutStorageLocation);
                }

                //collapse properties so they work in powerbi
                var propertiesToColapse = option.PropertiesToExpand;
                JsonUtil.CollapseJsonProperties(jsonObjects, propertiesToColapse);

                //write back the dax data into the model
                if (option.ExportDaxToFile)
                {
                    string daxStorageLocation = Path.Combine(sourcePath, "DaxMeasures.md");
                    DaxUtil.WriteDaxData(jsonObjects, daxStorageLocation);
                }

                var outputEncoding = new UnicodeEncoding(bigEndian: false, byteOrderMark: false);
                jsonString = JsonConvert.SerializeObject(jsonObjects, Formatting.Indented);
                File.WriteAllText(filePath, jsonString, outputEncoding);
            }
        }
        private static void convertSourceFilesToWorkWithGit(string destinationPath, SourceControlOption option)
        {
            //get full file path
            string filePath = Path.Combine(destinationPath, option.FileName);

            //check if unneeded file
            if (option.DeleteFile)
            {
                File.Delete(filePath);
                return;
            }

            //if the file we working with is an archive extract that file
            if (option.TreatAsArchive)
            {
                string archivePath = Path.Combine(destinationPath, option.FileName);
                string archiveExtractDestinationPath = Path.Combine(destinationPath, option.ArchiveDestinationPath);
                ZipUtil.ExtractArchive(archiveExtractDestinationPath, archivePath);
            }

            if (option.IsJsonFile)
            {
                //convert json string to jsonObjects
                string  jsonString  = File.ReadAllText(filePath, Encoding.Unicode);
                JObject jsonObjects = JObject.Parse(jsonString);

                //remove useless properties
                var propertiesToRemove = option.PropertiesToRemove;
                JsonUtil.RemoveJsonProperties(jsonObjects, propertiesToRemove);

                //expand properties so we can see changes in them
                var propertiesToExpand = option.PropertiesToExpand;
                JsonUtil.ExpandJsonProperties(jsonObjects, propertiesToExpand);

                //extract all the Dax information to a flat file
                if (option.ExportDaxToFile)
                {
                    string daxInformation     = DaxUtil.GetDaxData(jsonObjects);
                    string daxStorageLocation = Path.Combine(destinationPath, "DaxMeasures.md");
                    File.WriteAllText(daxStorageLocation, daxInformation);
                }

                //extract layout file
                if (option.FileName == "Report\\Layout")
                {
                    string layoutStorageLocation = Path.Combine(destinationPath, "Report", "LayoutFiles");
                    LayoutUtil.ExtractLayouts(jsonObjects, layoutStorageLocation);
                }

                //sort the json files so we can check them in source control
                jsonObjects = JsonUtil.SortPropertiesAlphabetically(jsonObjects);

                //convert back to a json string
                jsonString = JsonConvert.SerializeObject(jsonObjects, Formatting.Indented);
                File.WriteAllText(filePath, jsonString, Encoding.UTF8);
            }

            //rename the file with new extension
            if (!string.IsNullOrWhiteSpace(option.AddFileExtension))
            {
                var newFilePath = filePath + option.AddFileExtension;
                renameFile(filePath, newFilePath);
            }
        }