Improved event handling.
Extracted BasicResource.
Fixed tests and CreateDatabase.