private static MetadataRecord MapMetadataTableRow(QueryReader reader)
            {
                var pk          = PtrToStringUTF8(reader.ColumnText(0));
                var repoId      = checked ((int)reader.ColumnInt64(1));
                var containerId = checked ((int)reader.ColumnInt64(2));
                var parentId    = checked ((int)reader.ColumnInt64(3));
                var counter     = checked ((int)reader.ColumnInt64(4));
                var version     = checked ((int)reader.ColumnInt64(5));
                var remoteId    = checked ((int)reader.ColumnInt64(6));
                var permissions = checked ((int)reader.ColumnInt64(7));
                var schematype  = checked ((int)reader.ColumnInt64(8));
                var schema      = PtrToStringUTF8(reader.ColumnText(9));
                var metadata    = PtrToStringUTF8(reader.ColumnText(10));

                return(new MetadataRecord()
                {
                    PK = pk,
                    RepoId = repoId,
                    ContainerId = containerId,
                    ParentId = parentId,
                    Counter = counter,
                    Version = version,
                    RemoteId = remoteId,
                    Permissions = permissions,
                    SchemaType = (byte)schematype,
                    Schema = schema == null ? null : JsonSerializer.Deserialize <ContainerSchema>(schema),
                    Metadata = metadata == null ? null : JsonSerializer.Deserialize <Metadata>(metadata)
                });
            }