Extract code out of bin/quota_enforcer

- To make easier to test
- Also introduce Quota namespace since there are now multiple objects involved
- [#81697860]