pub(crate) fn create_position()     {

    //snip

// Counter is loaded before checking if we need it
let position_id_counter = POSITION_ID_COUNTER
    .may_load(deps.storage)?
    .unwrap_or_default()
    + 1u64;

// compute the identifier for this position
let identifier = if let Some(identifier) = identifier {
    // For explicit IDs, counter is never used
    format!("{EXPLICIT_POSITION_ID_PREFIX}{identifier}")
} else {
    // Only auto-generated IDs use the counter
    POSITION_ID_COUNTER.save(deps.storage, &position_id_counter)?;
    format!("{AUTO_POSITION_ID_PREFIX}{position_id_counter}")
};
    }
let identifier = if let Some(identifier) = identifier {
    // For explicit IDs, just format with prefix
    format!("{EXPLICIT_POSITION_ID_PREFIX}{identifier}")
} else {
    // Only load and increment counter for auto-generated IDs
    let position_id_counter = POSITION_ID_COUNTER
        .may_load(deps.storage)?
        .unwrap_or_default()
        + 1u64;
    POSITION_ID_COUNTER.save(deps.storage, &position_id_counter)?;
    format!("{AUTO_POSITION_ID_PREFIX}{position_id_counter}")
};
