class IgniteModelStorageUtil {

    public static <I extends Serializable, O extends Serializable> void saveModel(Ignite ignite,
        IgniteModel<I, O> mdl, String name) {
        IgniteModel<byte[], byte[]> mdlWrapper = wrapIgniteModel(mdl);
        byte[] serializedMdl = Utils.serialize(mdlWrapper);
        UUID mdlId = UUID.randomUUID();

        saveModelDescriptor(ignite, name, mdlId);

        try {
            saveModelEntity(ignite, serializedMdl, mdlId);
        }
        catch (Exception e) {
            // Here we need to do a rollback and remove descriptor from correspondent storage.
            removeModelEntity(ignite, mdlId);
            throw e;
        }
    }

}