// ToAccountRecord
 public AccountRecord ToAccountRecord()
 {
     return(StorageLayerUtility.CreateAccountRecord(
                name,
                new SaltedPasswordHash(
                    System.Convert.FromBase64String(passwordHash),
                    System.Convert.FromBase64String(salt)
                    ),
                new AccountID(id),
                null
                ));
 }
    /// <summary>
    /// This method gets a data reader which it's Read method is called and assumes the following structure
    /// (name,password,password length,salt,salt length,data,data length)
    /// </summary>
    /// <param name="dr"></param>
    /// <returns></returns>
    protected AccountRecord ReadAccountRecordFromDataReader(MySqlDataReader dr)
    {
        int passwordLength = dr.GetInt32(3);
        int saltLength     = dr.GetInt32(5);
        int dataLength     = dr.GetInt32(7);

        byte[] passwordBuffer = new byte[passwordLength];
        byte[] saltBuffer     = new byte[saltLength];
        byte[] dataBuffer     = (dataLength != 0) ? new byte[dataLength] : null;

        if (dataBuffer != null)
        {
            dr.GetBytes(dr.GetOrdinal("data"), 0, dataBuffer, 0, dataBuffer.Length);
        }
        dr.GetBytes(dr.GetOrdinal("password"), 0, passwordBuffer, 0, passwordBuffer.Length);
        dr.GetBytes(dr.GetOrdinal("salt"), 0, saltBuffer, 0, saltBuffer.Length);
        AccountRecord record = StorageLayerUtility.CreateAccountRecord(dr.GetString("name"),
                                                                       new uLobby.SaltedPasswordHash(passwordBuffer, saltBuffer),
                                                                       new uLobby.AccountID(dr.GetInt32("id").ToString()),
                                                                       dataBuffer);

        return(record);
    }