Under him , the caliphate became a hereditary office for the first time . He founded the Umayyad dynasty . Muawiyah transformed the caliphate into a hereditary office , thus founding the Umayyad dynasty .