class CreateCollectionActor {

    public void createTable(CreateCollectionWrapper message) throws CreateCollectionActorException {
        try {
            final ConnectionOptions options = IOC.resolve(Keys.getOrAdd(message.getConnectionOptionsRegistrationName()));
            final IPool pool = IOC.resolve(Keys.getOrAdd("PostgresConnectionPool"), options);

            String collectionName = message.getCollectionName();
            try (PoolGuard guard = new PoolGuard(pool)) {
                ITask task = IOC.resolve(
                        Keys.getOrAdd("db.collection.create-if-not-exists"),
                        guard.getObject(),
                        collectionName,
                        message.getOptions()
                );
                task.execute();
            } catch (TaskExecutionException | ResolutionException | PoolGuardException e) {
                throw new CreateCollectionActorException(e);
            }
        } catch (ReadValueException | ResolutionException e) {
            throw new CreateCollectionActorException(e);
        }
    }

}