On closer inspection, the hero status accorded to Abraham, Moses and David in the Old Testament (and echoed in the New Testament) is rooted not in their moral perfection but in their uncompromising dedication to the cause of Yahweh and their rugged trust in the promises of God rather than lapsing into the idolatry of many of their contemporaries.
Is God a Moral Monster?: Making Sense of the Old Testament God (ed. Baker Books, 2011) - ISBN: 9781441214546