/// <summary>
        /// Renders a code function
        /// </summary>
        /// <param name="exportSnippet">Export snippet to render the code for</param>
        /// <returns>Export snippet function</returns>
        private List <ExportSnippetFunction> RenderCodeFunction(ObjectExportSnippet exportSnippet)
        {
            ExportSnippetFunction function = new ExportSnippetFunction();

            function.FunctionName      = exportSnippet.SnippetName;
            function.Code              = exportSnippet.ScriptCode;
            function.ParentPreviewText = "";

            return(new List <ExportSnippetFunction> {
                function
            });
        }
        /// <summary>
        /// Renders a daily routine event node graph
        /// </summary>
        /// <param name="snippetName">Snippet name</param>
        /// <param name="scriptNodeGraph">Node graph to render</param>
        /// <param name="flexFieldObject">Npc to which the events belong</param>
        /// <returns>Task</returns>
        private async Task <List <ExportSnippetFunction> > RenderExportSnippetNodeGraph(string snippetName, NodeGraphSnippet scriptNodeGraph, FlexFieldObject flexFieldObject)
        {
            _nodeGraphParser.SetErrorCollection(_errorCollection);

            _curProject = await _cachedDbAccess.GetUserProject();

            _exportSettings = await _cachedDbAccess.GetExportSettings(_curProject.Id);

            SetupStepRenderes();

            ExportDialogData exportData = _nodeGraphParser.ParseNodeGraph(scriptNodeGraph);

            if (exportData == null)
            {
                return(new List <ExportSnippetFunction>());
            }

            exportData = await _nodeGraphFunctionGenerator.GenerateFunctions(flexFieldObject.ProjectId, flexFieldObject.Id, exportData, _errorCollection);

            ExportDialogFunction rootFunction = new ExportDialogFunction(exportData);

            AddNodesToFunction(rootFunction, exportData);
            List <ExportDialogFunction> additionalFunctions = ExtractAdditionalFunctions(exportData);

            List <ExportSnippetFunction> snippetFunctions    = new List <ExportSnippetFunction>();
            ExportSnippetFunction        snippetRootFunction = new ExportSnippetFunction();

            snippetRootFunction.FunctionName = snippetName;
            snippetRootFunction.Code         = await RenderDialogStepList(rootFunction.FunctionSteps, flexFieldObject);

            snippetRootFunction.ParentPreviewText = "";
            snippetFunctions.Add(snippetRootFunction);

            foreach (ExportDialogFunction curAdditionalFunction in additionalFunctions)
            {
                ExportSnippetFunction additionalFunction = new ExportSnippetFunction();
                additionalFunction.FunctionName      = curAdditionalFunction.RootNode.DialogStepFunctionName;
                additionalFunction.ParentPreviewText = await BuildFunctionParentPreview(curAdditionalFunction, flexFieldObject);

                string functionContent = await RenderDialogStepList(curAdditionalFunction.FunctionSteps, flexFieldObject);

                additionalFunction.Code = functionContent;

                snippetFunctions.Add(additionalFunction);
            }

            return(snippetFunctions);
        }