use crate::storage::Error;
use pbbson::{Model, prost::Message};
use serde::Serialize;

pub fn model_from_message<T: Message + Serialize>(other: &T) -> Result<Model, Error> {
    Model::try_from(other).map_err(|e| Error::internal(e.to_string()))
}
