/// <summary>
        /// Returns the TooltipContents after proxying through the task system to allow developers to modify the output
        /// </summary>
        /// <param name="ds"></param>
        /// <param name="sender"></param>
        /// <param name="entity"> </param>
        /// <param name="htmlContent"></param>
        /// <param name="width"></param>
        /// <param name="height"></param>
        /// <returns></returns>
        public static TooltipContents CreateTooltipContentsViaTask(this INodeSelectorDataSource ds,
                                                                   object sender,
                                                                   TypedEntity entity,
                                                                   string htmlContent,
                                                                   int width  = -1,
                                                                   int height = -1)
        {
            var args = new NodeSelectorTooltipEventArgs(entity, htmlContent)
            {
                Height = height,
                Width  = width
            };

            //launch task to modify the contents
            ds.FrameworkContext.TaskManager
            .ExecuteInContext(
                NodeSelectorTaskTriggers.GetTooltipContents,
                sender,
                new TaskEventArgs(ds.FrameworkContext, args));

            return(new TooltipContents(args.HtmlContents)
            {
                Height = args.Height,
                Width = args.Width
            });
        }
        /// <summary>
        /// Get the result of the CSharp code for the start node query
        /// </summary>
        /// <param name="dataTypeId"> </param>
        /// <param name="ds"></param>
        /// <param name="nodeId"></param>
        /// <param name="backOfficeRequestContext"> </param>
        /// <returns></returns>
        internal static HiveId GetStartNodeQueryResult(IBackOfficeRequestContext backOfficeRequestContext, HiveId dataTypeId, INodeSelectorDataSource ds, HiveId nodeId)
        {
            var virtualPathId = SetupCodeDelegateForQuery(backOfficeRequestContext, dataTypeId);

            var instance = GetClassInstance <AbstractStartNodeQuery>(virtualPathId);

            if (instance != null)
            {
                var entity = ds.GetEntity(nodeId);
                var root   = ds.GetEntity(ds.GetRootNodeId());
                return(instance.StartNodeId(backOfficeRequestContext, entity, root));
            }
            return(HiveId.Empty);
        }
        /// <summary>
        /// Get the result of the CSharp code for the node filter
        /// </summary>
        /// <param name="dataTypeId"> </param>
        /// <param name="ds"></param>
        /// <param name="nodeId"></param>
        /// <param name="backOfficeRequestContext"> </param>
        /// <returns></returns>
        internal static bool GetNodeFilterResult(IBackOfficeRequestContext backOfficeRequestContext, HiveId dataTypeId, INodeSelectorDataSource ds, HiveId nodeId)
        {
            var virtualPathId = SetupCodeDelegateForFilter(backOfficeRequestContext, dataTypeId);

            var instance = GetClassInstance <AbstractNodeFilter>(virtualPathId);

            if (instance != null)
            {
                var entity = ds.GetEntity(nodeId);
                return(instance.IsMatch(backOfficeRequestContext, entity));
            }
            return(true);
        }