Only loop through databases once

When mapping databases for API calls, only loop through the list once.