/// <summary>
        /// Helper method to easily convert the Dictionary Values into an array
        /// </summary>
        public FoldingReference[] ToArray()
        {
            var result = new FoldingReference[references.Count];

            references.Values.CopyTo(result, 0);
            return(result);
        }
        /// <summary>
        /// Adds a FoldingReference to the list and enforces ordering rules e.g. Only one fold per start line
        /// </summary>
        public void SafeAdd(FoldingReference item)
        {
            if (item == null)
            {
                return;
            }

            // Only add the item if it hasn't been seen before or it's the largest range
            if (references.TryGetValue(item.StartLine, out FoldingReference currentItem))
            {
                if (currentItem.CompareTo(item) == 1)
                {
                    references[item.StartLine] = item;
                }
            }
            else
            {
                references[item.StartLine] = item;
            }
        }