public static IRecordSerializer GetSerializer(ODatabase database)
        {
            //if (database.ProtocolVersion < 22)
            //    return (IRecordSerializer)new RecordCSVSerializer(database.GetConnection());
            //else
            //    return (IRecordSerializer)new RecordBinarySerializer(database.GetConnection());

            // Temporary return old serializer
            // TODO: Fix after implement binary serializer compleatly

            return (IRecordSerializer)new RecordCSVSerializer((database != null) ? database.GetConnection() : null);
        }
        public static IRecordSerializer GetSerializer(ODatabase database)
        {
            //if (database.ProtocolVersion < 22)
            //    return (IRecordSerializer)new RecordCSVSerializer(database.GetConnection());
            //else
            //    return (IRecordSerializer)new RecordBinarySerializer(database.GetConnection());

            // Temporary return old serializer
            // TODO: Fix after implement binary serializer compleatly

            return((IRecordSerializer) new RecordCSVSerializer((database != null) ? database.GetConnection() : null));
        }
        internal byte[] ReadToken(BinaryReader reader)
        {
            var size  = reader.ReadInt32EndianAware();
            var token = reader.ReadBytesRequired(size);

            // if token renewed
            if (token.Length > 0)
            {
                _database.GetConnection().Token = token;
            }

            return(token);
        }