Auto detect from what table to get attacments data