Lattice Dynamics and Electron Pairing in High Temperature Superconductors