Refactor cleaning up releases to a common function.