Add util function to clean up created entities from DB during testing (#535)
Add util function to clean up created entities from DB during testing (#535)

DeleteCreatedEntities records all created entities on the gorm.DB connection
and returns a function which can be called on defer to delete created entities
in reverse order on function exit.

Usage:

```go
func TestDatabaseActions(t *testing.T) {

  // setup database connection
  db := ....
  // setup auto clean up of created entities
  defer DeleteCreatedEntities(db)()

  repo := NewRepo(db)
  repo.Create(X)
  repo.Create(X)
  repo.Create(X)
}
```

Output:

```
Deleting from x 6d143405-1232-40de-bc73-835b543cd972
Deleting from x 0685068d-4934-4d9a-bac2-91eebbca9575
Deleting from x 2d20944e-7952-40c1-bd15-f3fa1a70026d
```
ALMighty/almighty-core,ldimaggi/almighty-core,ldimaggi/almighty-core,ldimaggi/almighty-core,ldimaggi/almighty-core