Collective treatment of the pairing Hamiltonian