class InMemoryDatabase implements IDatabase {

    @Override
    public void upsert(final IObject document, final String collectionName) throws IDatabaseException {
        try {
            DataBaseItem item = IOC.resolve(Keys.getOrAdd(DataBaseItem.class.getCanonicalName()), document, collectionName);
            if (null == item.getId()) {
                insert(item);
            } else {
                update(item);
            }
        } catch (ResolutionException e) {
            throw new IDatabaseException("Failed to create DataBaseItem", e);
        }
    }

    public  InMemoryDatabase();

}