class CreateAsyncOperationTask implements IDatabaseTask {

    @Override
    public void prepare(final IObject query) throws TaskPrepareException {
        try {
            task = IOC.resolve(
                    Keys.getOrAdd("db.collection.upsert"),
                    connection,
                    collectionNameField.in(query),
                    documentField.in(query)
            );
        } catch (ResolutionException e) {
            throw new TaskPrepareException("Can't create ISearchQuery from input query", e);
        } catch (ReadValueException | InvalidArgumentException e) {
            throw new TaskPrepareException("Can't change value in one of IObjects", e);
        }
    }

    public  CreateAsyncOperationTask(final IStorageConnection connection);

}