The logic could go in either place.  It was placed here to co-locate actual vs available and since the search criteria is different between scenarios (repoid vs id); however, the response in both cases is the same (i.e. list of modules).