Should remove_repositories() also handle filters that only contain the product of the repository (assuming you are removing the last repository of this product from the definition.