public static function getCategories($uid, $table)
    {
        $categoryData = array(
            'uid_list' => array(),
            'title_list' => array()
        );

        if ($uid && $table) {
            $queryBuilder = Db::getQueryBuilder($table);
            $categoryRecords = $queryBuilder
                ->add('select', '`sys_category`.`uid`, `sys_category`.`title`')
                ->from('sys_category')
                ->from('sys_category_record_mm')
                ->from($table)
                ->add(
                    'where',
                    '`sys_category`.`uid` = `sys_category_record_mm`.`uid_local`'
                    . ' AND `' . $table . '`.`uid` = `sys_category_record_mm`.`uid_foreign`'
                    . ' AND `' . $table . '`.`uid` = ' . $uid
                    . ' AND `sys_category_record_mm`.`tablenames` ="' . $table . '"'
                )
                ->add('orderBy', '`sys_category_record_mm`.`sorting`')
                ->execute()
                ->fetchAll();

            if (!empty($categoryRecords)) {
                foreach ($categoryRecords as $cat) {
                    $categoryData['uid_list'][] = $cat['uid'];
                    $categoryData['title_list'][] = $cat['title'];
                }
            }
        }

        return $categoryData;
    }