public static void Add(ref DynamicBuffer <PublicEntityRef> buffer, PublicEntityRef entityref)
        {
            int i = FindInsertionPoint(ref buffer, entityref);

            buffer.Insert(i, entityref);
        }
        private static unsafe int FindInsertionPoint(ref DynamicBuffer <PublicEntityRef> buffer, PublicEntityRef entityref)
        {
            int low  = 0;
            int high = buffer.Length;

            while (low != high)
            {
                int mid = (low + high) / 2;
                if (entityref < buffer[mid])
                {
                    high = mid;
                }
                else
                {
                    low = mid + 1;
                }
            }

            return(low);
        }