Refactor storage layer in preparation to support having multiple databases.