async function saveRecursively() {

                                // This will hold the information we need.
                                let timestampArray = []
                                let completeRecord = new Map()

                                // These will hold the paths to the information we need.
                                let pathToTimestamp
                                let pathToData = []


                                // Main actions are here
                                getDataPaths()
                                getData()

                                // Here we handle making the first file if need be.
                                let fileP = TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).FILE_PATH_ROOT +
                                "/Output/" + productDefinition.config.codeName
                                let basePath = global.env.PATH_TO_DATA_STORAGE
                                // If the file does not exist we create it.
                            if (SA.nodeModules.fs.existsSync(basePath + '/' + fileP) !== true && contextVariables.beginingOfMarket === undefined) {
                                existingFileContent = []
                                saveData()
                            } else {
                                thisReport.file.lastRun = new Date()
                                // Get Timestamp ready to build path to file.
                                let thisTimestamp = timestampArray[i]
                                let length = timestampArray.length - 1
                                lastTimestamp = timestampArray[length]
                                let lastStamp = checkTimestamp(lastTimestamp)
                                let timestamp = checkTimestamp(thisTimestamp)

                                // Build file path
                                let file = { date: new Date(timestamp) }
                                    file.year = file.date.getUTCFullYear()
                                    file.month = file.date.getUTCMonth() + 1
                                    file.day = file.date.getUTCDate()
                                    let dateForPath = file.year + '/' +
                                        SA.projects.foundations.utilities.miscellaneousFunctions.pad(file.month, 2) + '/' +
                                        SA.projects.foundations.utilities.miscellaneousFunctions.pad(file.day, 2)

                                try {
                                    let fileName = 'Data.json'
                                    let filePath =
                                        TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).FILE_PATH_ROOT +
                                        "/Output/" + productDefinition.config.codeName + "/" + outputDataset.referenceParent.config.codeName + '/' + dateForPath

                                    // Here we get the existing file content.
                                    let basePath = global.env.PATH_TO_DATA_STORAGE
                                    let fileBuffer = SA.nodeModules.fs.readFileSync(basePath + '/' + filePath + '/' + fileName)
                                    let existingFileContentString = fileBuffer.toString()
                                    let existingFileContent = existingFileContentString.replaceAll(/\n/g, '')
                                    let existingFile = JSON.parse(existingFileContent)
                                    saveData(existingFile)
                                } catch (err) {
                                    if (err) {
                                        SA.logger.error('[ERROR]' + err.message + err.stack)
                                    } else {
                                        SA.logger.error('[Success] Files Updated')
                                    }
                                }
                            }


                                /** This function gets the paths to the data we want as defined at the API Response Field Reference at the data mine. */
                                function getDataPaths() {
                                    if (productDefinition.record !== undefined) {
                                        if (productDefinition.record.properties !== undefined) {
                                            let record = productDefinition.record.properties

                                            /**Here we loop through all record definition nodes and gather the paths to the needed information. */
                                            for (let j = 0; j < record.length; j++) {
                                                let thisRecord = record[j]
                                                /** First we get the path to the timestamp. */
                                                if (thisRecord.name === 'timestamp' || thisRecord.name === 'Timestamp') {
                                                    if (thisRecord.apiResponseFieldReference !== undefined && thisRecord.apiResponseFieldReference.config !== undefined) {
                                                        let thisConfig = thisRecord.apiResponseFieldReference.config
                                                        if (thisConfig.nodePath !== undefined && thisConfig.nodePath !== '') {
                                                            pathToTimestamp = thisConfig.nodePath
                                                        } else {
                                                            SA.logger.error('The path to the timestamp is not defined.')
                                                        }
                                                    } else {
                                                        SA.logger.error('We have encountered a problem with the apiResponseFieldReference.')
                                                    }
                                                } else {
                                                    /**If the record is not a timestamp we will assume it is data. */
                                                    if (thisRecord.apiResponseFieldReference !== undefined && thisRecord.apiResponseFieldReference.config !== undefined) {
                                                        let thisConfig = thisRecord.apiResponseFieldReference.config
                                                        if (thisConfig.nodePath !== undefined && thisConfig.nodePath !== '') {
                                                            let thisPath = thisConfig.nodePath
                                                            pathToData.push(thisPath)
                                                        } else {
                                                            SA.logger.error('The path to the data record is not defined.')
                                                        }
                                                    } else {
                                                        SA.logger.error('We have encountered a problem with the apiResponseFieldReference.')
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }

                                function getData() {
                                    if (dataReceivedObject !== undefined) {
                                        /** Here we are going to loop through the data object received and gather all the defined information. */
                                            if (dataReceivedObject.data !== undefined) {
                                                for (let i = 0; i < dataReceivedObject.data.length; i++) {
                                                    let thisTime
                                                    let dataArray = []
                                                    let timestampPath = pathToTimestamp.split('['|']')

                                                    // First we must control our path info to iterate through all data in the API response.
                                                    switch (timestampPath.length) {
                                                        case (1): {
                                                            SA.logger.info('This data does not have anything to loop through. Please use a different save option.')
                                                            break
                                                        }
                                                        // If two we will count up and loop through all possible responses.
                                                        case (2): {
                                                            let tPath = timestampPath[0] + i + timestampPath[1]
                                                            thisTime = eval(tPath)
                                                            timestampArray.push(thisTime)
                                                            break
                                                        }
                                                        case (4): {
                                                            // TODO handle iterating through multiple arrays in the same path
                                                            break
                                                        }
                                                    }
                                                    

                                                    /** Here we will loop through the rest of the data defined at the record properties. */
                                                    for (let j = 0; j < pathToData.length; j++) {
                                                        let thisDataP = pathToData[j]
                                                        let dataPath = thisDataP.split('['|']')
        
                                                        switch (dataPath.length) {
                                                            case (1): {
                                                                SA.logger.info('This data does not have anything to loop through. Please use a different save option.')
                                                                break
                                                            }
                                                            // If two we will count up and loop through all possible responses.
                                                            case (2): {
                                                                let dPath = dataPath[0] + i + dataPath[1]
                                                                let thisData = eval(dPath)
                                                                // Here we get the name to call the record.
                                                                let nameSplit = dataPath[1].split('.')
                                                                let recordName = nameSplit[1]
                                                                let thisRecord = {
                                                                    [recordName] : thisData
                                                                }
                                                                dataArray.push(thisData)
                                                                break
                                                            }
                                                            case (4): {
                                                                // TODO handle iterating through multiple arrays in the same path
                                                                break
                                                            }
                                                        }
                                                    }
                                                    completeRecord.set(thisTime, dataArray)
                                                }
                                            }
                                            if (dataReceivedObject.length !== undefined) {
                                                for (let i = 0; i < dataReceivedObject.length; i++) {

                                                    // Here we initialize what we need inside this loop.
                                                    let thisTime
                                                    let dataArray = []
                                                    let timestampPath = pathToTimestamp.split('['|']')
                                                    let tPath
        
                                                    // First we must control our path info to iterate through all timestamps in the API response.
                                                    // Here we gather all of our defined paths and get the timestamps at those locations.
                                                    switch (timestampPath.length) {
                                                        case (1): {
                                                            let thisObject = dataReceivedObject[i]
                                                            let singlePath = pathToTimestamp.split('.')
                                                            tPath = singlePath[1]
                                                            thisTime = thisObject[tPath]
                                                            
                                                            timestampArray.push(thisTime)
                                                            break
                                                        }
                                                        // If two we will count up and loop through all possible responses.
                                                        case (2): {
                                                            tPath = timestampPath[0] + i + timestampPath[1]
                                                            thisTime = eval(tPath)
                                                            timestampArray.push(thisTime)
                                                            break
                                                        } 
                                                        case (4): {
                                                            // TODO handle iterating through multiple arrays in the same path
                                                            break
                                                        }
                                                    }

                                                    // First we must control our path info to iterate through all data in the API response.
                                                    // Here we gather all of our defined paths and get the data at those locations.
                                                    for (let j = 0; j < pathToData.length; j++) {
                                                        let thisDataP = pathToData[j]
                                                        let dataPath = thisDataP.split('['|']')
                                                        let dPath
                                                        let thisData

                                                        switch (dataPath.length) {
                                                            case (1): {
                                                                let thisObject = dataReceivedObject[i]
                                                                let singlePath = thisDataP.split('.')
                                                                let levelPath = singlePath[1]
                                                                let thisData = thisObject[levelPath]
                                                                dataArray.push(thisData)
                                                                break
                                                            }
                                                            case (2): {
                                                                let dPath = dataPath[0] + i + dataPath[1]
                                                                thisData = eval(dPath)

                                                                // Here we get the name to call the record.
                                                                let nameSplit = dataPath[1].split('.')
                                                                let recordName = nameSplit[1]
                                                                let thisRecord = {
                                                                    [recordName] : thisData
                                                                }
                                                                dataArray.push(thisData)
                                                                break
                                                            }
                                                            case (4): {
                                                                // TODO handle iterating through multiple arrays in the same path
                                                                break
                                                            }
                                                        }
                                                    }
                                                    completeRecord.set(thisTime, dataArray)
                                                }
                                            }
                                    } else {
                                        SA.logger.error('dataReceivedObject is not defined. We have no data to save.')
                                    }
                                }

                                

                                //Now what we have all the needed info, here we loop through and build the files / save the data.
                                function saveData(existingFile) {
                                    
                                    let thisFile
                                    
                                    // Here we will check to see if all timestamps received belong to the same file date or not.
                                    for (let t = 0; t < timestampArray.length; t++) {
                                        let timeToCheck = timestampArray[t]
                                        let thisTime = checkTimestamp(timeToCheck)

                                        let file = { date: new Date(thisTime) }
                                        file.year = file.date.getUTCFullYear()
                                        file.month = file.date.getUTCMonth() + 1
                                        file.day = file.date.getUTCDate()
                                        let dateForPath = file.year + '/' +
                                            SA.projects.foundations.utilities.miscellaneousFunctions.pad(file.month, 2) + '/' +
                                            SA.projects.foundations.utilities.miscellaneousFunctions.pad(file.day, 2)

                                            if (fileDateArray.length > 0) {
                                                let lastDateArrayEntryNum = fileDateArray.length - 1
                                                let lastDateArrayEntry = fileDateArray[lastDateArrayEntryNum]
                                                if (lastDateArrayEntry !== dateForPath) {
                                                    fileDateArray.push(dateForPath)
                                                }
                                            } else {
                                                fileDateArray.push(dateForPath)
                                            }
                                            
                                    }
                                    
                                        /*
                                        Note: Possible optimation is to not read daily file but to simply append to it. 
                                        Currently loads last file date, loads current file and then looks through timestamps to determine 
                                        if current record should be appended to file.
                                        */
                                        if (thisReport.file.lastFile !== undefined) {
                                            let lastRecordDate = thisReport.file.lastFile
                                            let lastRecordDateString = JSON.stringify(lastRecordDate)
                                            let lastRecordDateYear = lastRecordDateString.substring(1, 5)
                                            let lastRecordDateMonth = lastRecordDateString.substring(6, 8)
                                            let lastRecordDateDay = lastRecordDateString.substring(9, 11)
                                            lastDate = lastRecordDateYear + "/" + lastRecordDateMonth + "/" + lastRecordDateDay
                                        } else {
                                            lastDate = ""
                                        }


                                        if (existingFile !== undefined) {

                                            // We will loop through each line of the record and see about adding it to the file for saving!
                                            for (let c = 0; c < completeRecord.size; c++) {
                                                let thisFile = []
                                                let content = Array.from(completeRecord)
                                                let thisContent = content[c]
                                                // In order to not save duplicates we will check the last timestamp on file and not save any timestamps less than or equal to it.
                                                let existingFileLength = existingFile.length - 1
                                                let lastFileEntry = existingFile[existingFileLength]
                                                let lastTimeOnFile = lastFileEntry[0]

                                                let fileT = thisContent[0]
                                                let time = checkTimestamp(fileT)
                                                dateForPath = checkSameFileDate(time)
                                                let fileC = thisContent[1]

                                                // If timestamp is older the the last timestamp on file we save nothing and proceed through the data.
                                                if (lastTimeOnFile < time) {
                                                    fileC.unshift(time)
                                                    existingFile.push(fileC)
                                                }
                                            }

                                            existingFileContent = JSON.stringify(existingFile)

                                            saveDatasetFile("/" + dateForPath)
                                            writeStatusReport()
                                            SA.logger.info('[Success] API Response Saved.')
                                            return

                                        } else {
                                            // If the existingFile is not defined then this is the first time running.
                                            for (let c = 0; c < completeRecord.size; c++) {
                                                let runCount = c 
                                                let content = Array.from(completeRecord)
                                                let thisContent = content[c]

                                                // This is the timestamp we use to build the path.
                                                let fileT = thisContent[0]
                                                let time = checkTimestamp(fileT)

                                                if (runCount === 0) {
                                                    thisFile = []
                                                    // Here we handle the beginning of the market for our status report.
                                                    if (contextVariables.beginingOfMarket === undefined) {
                                                        contextVariables.beginingOfMarket = new Date(time)
                                                    }
                                                } 

                                                dateForPath = checkSameFileDate(time)
                                            
                                                let fileC = thisContent[1]
                                                fileC.unshift(time)
                                                thisFile.push(fileC)

                                            existingFileContent = JSON.stringify(thisFile)

                                            // If the path to the file does not exist we get ready to make it.
                                            let fileName = 'Data.json'
                                            let filePath =
                                                TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).FILE_PATH_ROOT +
                                                "/Output/" + productDefinition.config.codeName + "/" + outputDataset.referenceParent.config.codeName + '/' + dateForPath
                                    
                                            let basePath = global.env.PATH_TO_DATA_STORAGE
                                            if (SA.nodeModules.fs.existsSync(basePath + '/' + filePath + '/' + fileName) !== true) {
                                                thisReport.file.lastRun = new Date()
                                        }

                                        saveDatasetFile("/" + dateForPath)

                                        if ((content.length - 1) === c) {
                                            writeStatusReport()
                                            SA.logger.info('[Success] API Response Saved.')
                                            return
                                        }
                                    }
                                }
                            } 


                                // Here we verify the timestamp is the correct length and if it is not correct it.
                                function checkTimestamp(thisTimestamp) {
                                    let timestamp = thisTimestamp
                                    let startStamp = timestamp
                                    let numberOfDigits = 0

                                    while (startStamp != 0 && startStamp > 1) {
                                            startStamp = startStamp / 10
                                            numberOfDigits++
                                        }
                                    
                                    if (numberOfDigits == 10) {
                                        timestamp = timestamp * 1000
                                        return timestamp
                                    }

                                    if (numberOfDigits == 19) {
                                        timestamp = timestamp / 1000000
                                        return Math.trunc(timestamp)
                                    }

                                    if (numberOfDigits == 13) {
                                        return timestamp
                                    }
                                }

                                function checkSameFileDate(time) {
                                    for (let e = 0; e < fileDateArray.length; e++) {
                                        let thisFileDate = fileDateArray[e]

                                        let file = { date: new Date(time) }
                                        file.year = file.date.getUTCFullYear()
                                        file.month = file.date.getUTCMonth() + 1
                                        file.day = file.date.getUTCDate()
                                        let dateForPath = file.year + '/' +
                                            SA.projects.foundations.utilities.miscellaneousFunctions.pad(file.month, 2) + '/' +
                                            SA.projects.foundations.utilities.miscellaneousFunctions.pad(file.day, 2)

                                        if (dateForPath === thisFileDate) {
                                            /* We will need to save this at the Status Report */
                                            contextVariables.lastFile = file.date
                                            return dateForPath
                                        }
                                    }
                                }
                            }
This function is intended for use with API responses.
In its current state it can handle any API response with 0-1 arrays included in the path located at the API response field reference inside the data mine.
Example:     "apiResponseReceivedObject.data[0].timestamp" 
             "apiResponseReceivedObject.data.timestamp