public SerialId InitializeSerialId(int idRoot)
        {
            SerialId id = new SerialId();
            id.IdRoot = idRoot;

            //get random session ID
            int session = rnd.Next(1000, 9999);

            //get random starting serial ID
            int serial = rnd.Next(1, 100000);

            id.IdSession = session;
            id.IdSerial = serial;

            return id;
        }
        public static SerialId IncrementSerialId(SerialId id)
        {
            int serial = id.IdSerial;

            SerialId newId = new SerialId();

            //increment serial
            if (serial == Int32.MaxValue) serial = 0;
            serial++;

            newId.IdRoot = id.IdRoot;
            newId.IdSession = id.IdSession;
            newId.IdSerial = serial;

            return newId;
        }