Optimize a series of nested database queries or API calls that are causing severe latency in a backend service.