How much logic should I keep at the database vs. application layer? | Lobsters