Implement the write function. Write first skell for read function.