I need help understanding direct and indirect objects in a sentence. The sentence is Several players gave him a pat on the back.

I have to identify the direct object and indirect object. I think the direct object is him and the indirect object is pat. I can convert the sentence to read Several players gave a pat on the back to him.

Am I correct? Just want to be sure I understand the concept before I do the rest.