public function addToBuiltModules($module, $form_ids)
{
$existing_module = BuiltModule::whereNotNull('hash')->where('hash', $module['info']['hash'])->first();
$table_names = array_pluck($module['forms'], 'table');
$table_name = implode('|', $table_names);
$module_info = array('name' => $module['info']['name'], 'hash' => $module['info']['hash'], 'alias' => $module['info']['alias'], 'version' => $module['info']['version'], 'author' => $module['info']['author'], 'website' => $module['info']['website'], 'description' => $module['info']['description'], 'form_id' => implode(', ', $form_ids), 'target' => $module['target'], 'table_name' => $table_name);
if ($existing_module) {
$existing_module->update($module_info);
} else {
// To indicate that the module is not created in this system
$module_info['is_author'] = false;
BuiltModule::create($module_info);
}
}