Here "Israel" represents the army of Israel. Alternate translation: "assembled all the army of Israel together" (See: [[rc://en/ta/man/translate/figs-metonymy]])
Here David represents himself and his soldiers. Alternate translation: "against David and his soldiers and fought them" (See: [[rc://en/ta/man/translate/figs-synecdoche]])