Make important security entities Serializable
#2525 fix for detachAll so it supports cycles
Merge pull request #3071 from wouterv/detachAll-cycle-fix

#2525 fix for detachAll so it supports cycles
Merge pull request #3070 from PhantomYdn/fix-serializable-in-security

Make important security entities Serializable