public async Task <VersionData> GetVersionDataAsync(int versionId)
        {
            using (var ctx = MainProvider.CreateDataContext(CancellationToken.None))
            {
                return(await ctx.ExecuteReaderAsync("SELECT * FROM Versions WHERE VersionId = @VersionId", cmd =>
                {
                    cmd.Parameters.Add(ctx.CreateParameter("@VersionId", DbType.Int32, versionId));
                }, async (reader, cancel) =>
                {
                    if (!await reader.ReadAsync(cancel))
                    {
                        return null;
                    }

                    return new VersionData
                    {
                        VersionId = DataReaderExtension.GetInt32(reader, "VersionId"),
                        NodeId = DataReaderExtension.GetInt32(reader, "NodeId"),
                        Version = new VersionNumber(DataReaderExtension.GetInt16(reader, "MajorNumber"), DataReaderExtension.GetInt16(reader, "MinorNumber"),
                                                    (VersionStatus)DataReaderExtension.GetInt16(reader, "Status")),
                        CreationDate = reader.GetDateTimeUtc("CreationDate"),
                        CreatedById = reader.GetSafeInt32("CreatedById"),
                        ModificationDate = reader.GetDateTimeUtc("ModificationDate"),
                        ModifiedById = reader.GetSafeInt32("ModifiedById"),
                        ChangedData = reader.GetChangedData("ChangedData"),
                        Timestamp = reader.GetSafeLongFromBytes("Timestamp"),
                    };
                }));
            }
        }
        public async Task <NodeHeadData> GetNodeHeadDataAsync(int nodeId)
        {
            using (var ctx = MainProvider.CreateDataContext(CancellationToken.None))
            {
                return(await ctx.ExecuteReaderAsync("SELECT * FROM Nodes WHERE NodeId = @NodeId", cmd =>
                {
                    cmd.Parameters.Add(ctx.CreateParameter("@NodeId", DbType.Int32, nodeId));
                }, async (reader, cancel) =>
                {
                    if (!await reader.ReadAsync(cancel))
                    {
                        return null;
                    }

                    return new NodeHeadData
                    {
                        NodeId = DataReaderExtension.GetInt32(reader, "NodeId"),
                        NodeTypeId = DataReaderExtension.GetInt32(reader, "NodeTypeId"),
                        ContentListTypeId = reader.GetSafeInt32("ContentListTypeId"),
                        ContentListId = reader.GetSafeInt32("ContentListId"),
                        CreatingInProgress = reader.GetSafeBooleanFromByte("CreatingInProgress"),
                        IsDeleted = reader.GetSafeBooleanFromByte("IsDeleted"),
                        ParentNodeId = reader.GetSafeInt32("ParentNodeId"),
                        Name = DataReaderExtension.GetString(reader, "Name"),
                        DisplayName = reader.GetSafeString("DisplayName"),
                        Path = DataReaderExtension.GetString(reader, "Path"),
                        Index = reader.GetSafeInt32("Index"),
                        Locked = reader.GetSafeBooleanFromByte("Locked"),
                        LockedById = reader.GetSafeInt32("LockedById"),
                        ETag = DataReaderExtension.GetString(reader, "ETag"),
                        LockType = reader.GetSafeInt32("LockType"),
                        LockTimeout = reader.GetSafeInt32("LockTimeout"),
                        LockDate = reader.GetDateTimeUtc("LockDate"),
                        LockToken = DataReaderExtension.GetString(reader, "LockToken"),
                        LastLockUpdate = reader.GetDateTimeUtc("LastLockUpdate"),
                        LastMinorVersionId = reader.GetSafeInt32("LastMinorVersionId"),
                        LastMajorVersionId = reader.GetSafeInt32("LastMajorVersionId"),
                        CreationDate = reader.GetDateTimeUtc("CreationDate"),
                        CreatedById = reader.GetSafeInt32("CreatedById"),
                        ModificationDate = reader.GetDateTimeUtc("ModificationDate"),
                        ModifiedById = reader.GetSafeInt32("ModifiedById"),
                        IsSystem = reader.GetSafeBooleanFromByte("IsSystem"),
                        OwnerId = reader.GetSafeInt32("OwnerId"),
                        SavingState = reader.GetSavingState("SavingState"),
                        Timestamp = reader.GetSafeLongFromBytes("Timestamp"),
                    };
                }));
            }
        }