public static IList <CachedVisualTextLine> ConvertToCachedLines(this VisualCollection collection, int count, int omit = 0)
        {
            var fragment = collection.ToEnumerableOf <VisualTextLine>().Skip(omit).Take(count);

            return(fragment.Select(line => {
                var collapsedLine = line as CollapsedVisualTextLine;
                var singleLine = line as SingleVisualTextLine;

                if (collapsedLine != null)
                {
                    return collapsedLine.ToCachedLine();
                }
                if (singleLine == null)
                {
                    throw new ArgumentException(nameof(line));
                }

                return singleLine.ToCachedLine();
            }).ToList());
        }