api: Extract repo ID validation to a separate function (RhBug:1018284)