It is not exactly the same, but it can be refactored, definitely. Will file a bug for that.