private static List <ZPackage> ChunkMapData(List <MapRange> mapData, int chunkSize = 10000)
        {
            if (mapData == null || mapData.Count == 0)
            {
                return(null);
            }

            //Chunk the map data into pieces based on the maximum possible map data
            List <List <MapRange> > chunkedData = mapData.ChunkBy(chunkSize);

            List <ZPackage> packageList = new List <ZPackage>();

            //Iterate the chunks
            foreach (List <MapRange> thisChunk in chunkedData)
            {
                ZPackage pkg = new ZPackage();

                //Write number of MapRanges in this package
                pkg.Write(thisChunk.Count);

                //Write each MapRange in this chunk to this package.
                foreach (MapRange mapRange in thisChunk)
                {
                    pkg.WriteVPlusMapRange(mapRange);
                }

                //Write boolean dictating if this is the last chunk in the ZPackage sequence
                if (thisChunk == chunkedData.Last())
                {
                    pkg.Write(true);
                }
                else
                {
                    pkg.Write(false);
                }

                //Add the package to the package list
                packageList.Add(pkg);
            }

            return(packageList);
        }