refactored the pointer usage in insertPrincipalMetadata
fix added tx.Rollback in err handling
Merge pull request #62 from chruffer/principal_refactored

refactored the pointer usage in insertPrincipalMetadata