Deep copy shameless copied of `angular.copy` from AngularJS with some modifications