nsertProcess :: DBInfo -> MachineId -> ProcessId -> IO DBInfo
insertProcess dbi mid pid = do
    let conn       = db_connection dbi
        machineKey = (db_machines dbi) M.! mid
    processKey <- head <$> query conn insertProcessQuery (pid, machineKey)
    case processKey of
        Only key -> do
            return $ dbi {
                db_processes   = M.insert (mid,pid) key (db_processes dbi)
                }
        _       -> error "machine insertion failed"

insertProcess :: DBInfo -> MachineId -> ProcessId -> IO DBInfo
insertProcess dbi mid pid = do
    let conn       = db_connection dbi
        machineKey = (db_machines dbi) M.! mid
    processKey <- head <$> query conn insertProcessQuery (pid, machineKey)
    case processKey of
        Only key -> do
            return $ dbi {
                db_processes   = M.insert (mid,pid) key (db_processes dbi)
                }
        _       -> error "machine insertion failed"
insertProcess dbi mid pid = do
    let conn       = db_connection dbi
        machineKey = (db_machines dbi) M.! mid
    processKey <- head <$> query conn insertProcessQuery (pid, machineKey)
    case processKey of
        Only key -> do
            return $ dbi {
                db_processes   = M.insert (mid,pid) key (db_processes dbi)
                }
        _       -> error "machine insertion failed"