Added simple helpers for error handling in resources
Removed callbacks from db, using deferreds instead