Great answer on Quora from one of the developers of Spotify.

I often find myself in situations exactly like the one Mattias creates here. Multiple calls to the same service, with just slight variations between one another.

I’ve learned the hard way to manage this kind of behavior while writing code.

What I think should resonate here:

Wait for three instances of duplication before generalizing.