Add some error handling to write endpoint
Return item as json on successful write requests