Storing orders in a database