class ContextualPreferenceDao extends NamedParameterJdbcDaoSupport {

    public ContextualPreference upsert(final ContextualPreference preference) {
        final ContextualPreference upsertingPreference = preference.withCreatedDate(DateUtils.now());
        getNamedParameterJdbcTemplate().update(
                insertContextualPreferenceQuery,
                Parameters.getParameters(upsertingPreference)
        );
        return upsertingPreference;
    }

}