public IPathNode NewItem(IContext context, string path, string itemTypeName, object newItemValue)
        {
            if (path.StartsWith("$"))
            {
                throw new ArgumentException("Task item names cannot start with $");
            }
            if (path.ToLowerInvariant() == Name.ToLowerInvariant())
            {
                var items = GetNodeChildren(context);
                path = "$" + items.Count();
            }

            newItemValue = newItemValue ?? String.Empty;
            var p = (NewTaskItemParameters)context.DynamicParameters;

            var item = _tasks.Add(p.Category, p.Category, newItemValue.ToString(), p.Priority, p.Icon, p.Checkable, p.File,
                                  p.Line, p.ReadOnly, !p.NoFlush);

            item.Collection.ForceItemsToTaskList();

            var factory = new TaskItemNodeFactory(item);

            return(factory.GetNodeValue());
        }
        public IPathNode NewItem(IContext context, string path, string itemTypeName, object newItemValue)
        {
            if (path.StartsWith("$"))
            {
                throw new ArgumentException("Task item names cannot start with $");
            }
            if (path.ToLowerInvariant() == Name.ToLowerInvariant())
            {
                var items = GetNodeChildren( context );
                path = "$" + items.Count();
            }

            newItemValue = newItemValue ?? String.Empty;
            var p = (NewTaskItemParameters) context.DynamicParameters;

            var item = _tasks.Add(p.Category, p.Category, newItemValue.ToString(), p.Priority, p.Icon, p.Checkable, p.File,
                                  p.Line, p.ReadOnly, !p.NoFlush);
            item.Collection.ForceItemsToTaskList();

            var factory = new TaskItemNodeFactory(item);
            return factory.GetNodeValue();
        }