internal static void Update_NodeSummaryContainer_NodeSourceTextContent(NodeSummaryContainer nodeSummaryContainer, TextContentCollection localCollection, TextContentCollection masterCollection)
 {
     var nodes = nodeSummaryContainer.Nodes;
     nodes.CollectionContent.RemoveAll(node => node.TechnicalSource == NodeSourceTypeTextContent);
     var textContentNodes = masterCollection.CollectionContent.Select(getNodeFromTextContent).ToArray();
     nodes.CollectionContent.AddRange(textContentNodes);
     cleanUpRenderedNodes(nodes);
 }
 internal static void Update_NodeSummaryContainer_NodeSourceBinaryFiles(NodeSummaryContainer nodeSummaryContainer, BinaryFileCollection localCollection, BinaryFileCollection masterCollection)
 {
     var nodes = nodeSummaryContainer.Nodes;
     nodes.CollectionContent.RemoveAll(node => node.TechnicalSource == NodeSourceTypeBinaryFile);
     var binaryFileNodes = masterCollection.CollectionContent.Select(getNodeFromBinaryFile).ToArray();
     nodes.CollectionContent.AddRange(binaryFileNodes);
     cleanUpRenderedNodes(nodes);
 }
        internal static void Update_NodeSummaryContainer_NodeSourceCategories(NodeSummaryContainer nodeSummaryContainer, CategoryCollection localCollection, CategoryCollection masterCollection)
        {
            var nodes = nodeSummaryContainer.Nodes;
            nodes.CollectionContent.RemoveAll(node => node.TechnicalSource == NodeSourceTypeCategory);
            /*
            var usedParentCategoryIDs =
                masterCollection.CollectionContent.Where(cat => cat.ParentCategory != null)
                                .Select(cat => cat.ParentCategory.ID)
                                .ToArray();
            var nodeCategories =
                masterCollection.CollectionContent.Where(cat => usedParentCategoryIDs.Contains(cat.ID)).ToArray();
             * */
            var nodeCategories = masterCollection.CollectionContent.Where(cat => cat.ImageData != null).ToArray();
            var categoryNodes = nodeCategories.Select(getNodeFromCategory).ToArray();
            //var categoryNodes = masterCollection.CollectionContent.Select(getNodeFromCategory).ToArray();
            nodes.CollectionContent.AddRange(categoryNodes);
            cleanUpRenderedNodes(nodes);
            if(localCollection == null)
                localCollection = new CategoryCollection();
            localCollection.CollectionContent = masterCollection.CollectionContent;
            localCollection.RefreshOrderAndFilterListFromContent();

            // Sort categories based on the collection
            var flattenedArray = nodeSummaryContainer.NodeSourceCategories.SelectedIDCommaSeparated.Split(',');
            string commaSeparatedIDs = String.Join(",", flattenedArray);
            nodeSummaryContainer.NodeSourceCategories.SelectedIDCommaSeparated = commaSeparatedIDs;
            var newList =
                nodeSummaryContainer.NodeSourceCategories.CollectionContent.OrderBy(
                    cat => Array.IndexOf(flattenedArray, cat.ID)).ToList();
            nodeSummaryContainer.NodeSourceCategories.CollectionContent = newList;
        }
 internal static void Update_NodeSummaryContainer_NodeSourceActivities(NodeSummaryContainer nodeSummaryContainer, ActivityCollection localCollection, ActivityCollection masterCollection)
 {
     const string DefaultAuthorValue = "Aalto Global Impact";
     var nodes = nodeSummaryContainer.Nodes;
     nodes.CollectionContent.RemoveAll(node => node.TechnicalSource == NodeSourceTypeActivity);
     var activityNodes = masterCollection.CollectionContent.Select(getNodeFromActivity).ToArray();
     nodes.CollectionContent.AddRange(activityNodes);
     nodes.CollectionContent.ForEach(node =>
         {
             if (node.Authors.CollectionContent.Count == 0)
                 node.Authors.CollectionContent.Add(getShortTextObject(DefaultAuthorValue));
             else
             {
             var firstAuthorObject = node.Authors.CollectionContent[0];
                 if (String.IsNullOrWhiteSpace(firstAuthorObject.Content))
                 {
                     firstAuthorObject.Content = DefaultAuthorValue;
                 }
             }
         });
     cleanUpRenderedNodes(nodes);
 }