Implement WriteRequest and add tests.