Unified function for get write data