}
try
{
//try to get entry for user (if they have one)
FavoriteUIModulePojo moduleQuery = new FavoriteUIModulePojo();
moduleQuery.setProfileId(new ObjectId(profileId));
DBObject dbo = DbManager.getSocial().getUIFavoriteModules().findOne(moduleQuery.toDb());
if ( dbo != null )
{
//found old entry, update it with new modules
FavoriteUIModulePojo ump = FavoriteUIModulePojo.fromDb(dbo, FavoriteUIModulePojo.class);
ump.setQuickModules(modids);
DbManager.getSocial().getUIFavoriteModules().update(moduleQuery.toDb(), ump.toDb());
}
else
{
//no entry exists for this user, create a new one
FavoriteUIModulePojo ump = new FavoriteUIModulePojo();
ump.set_id(new ObjectId());
ump.setProfileId(moduleQuery.getProfileId());
ump.setQuickModules(modids);
ump.setTimestamp(new Date());
DbManager.getSocial().getUIFavoriteModules().insert(ump.toDb());
}
rp.setResponse(new ResponseObject("Save Modules",true,"modules saved successfully"));
}
catch (Exception ex)
{