Hamed Ben Abdala, Secretary to the Prince of Barbary