How to write back to databases