I feel like the logic in this route is too branched, it's not a blocker, but after merged we'll need to create an issue to revisit it for modularization.