Added insert and update file code from the API docs