$oInsiders->query();
 $aInsiders = array();
 if ($oInsiders->count() > 0) {
     while ($oInsider = $oInsiders->next()) {
         $aInsiders[] = $oInsider->get($oInsider->primaryKey);
     }
 }
 // Filter
 if ($_REQUEST["member_filter"] != "") {
     if ($_REQUEST["member_searchin"] == "--all--" || $_REQUEST["member_searchin"] == "") {
         foreach ($aFields as $sKey => $aData) {
             if (strpos($aData["type"], "search") !== false) {
                 $oInsiders->setWhereGroup("filter", "recipientcollection." . $aData["field"], $_REQUEST["member_filter"], "LIKE");
             }
         }
         $oInsiders->setInnerGroupCondition("filter", "OR");
     } else {
         $oInsiders->setWhere("recipientcollection." . $_REQUEST["member_searchin"], $_REQUEST["member_filter"], "LIKE");
     }
 }
 // If elemperpage is something else than "all", get item count based on filters
 if ($_REQUEST["member_elemperpage"] > 0) {
     $oInsiders->query();
     $iMembers = $oInsiders->count();
     // Getting item count without limit (for page function) - better idea anybody (performance)?
     $oInsiders->setLimit($_REQUEST["member_elemperpage"] * ($_REQUEST["member_page"] - 1), $_REQUEST["member_elemperpage"]);
 } else {
     $iMembers = 0;
 }
 // Get data
 $sSortSQL = "recipientcollection." . $_REQUEST["member_sortby"] . " " . $_REQUEST["member_sortorder"];
// sort by and sort order
$oRecipients->setOrder("recipientcollection." . $_REQUEST["sortby"] . " " . $_REQUEST["sortorder"]);
// Show group
if ($_REQUEST["restrictgroup"] != "--all--") {
    $oRecipients->link("RecipientGroupMemberCollection");
    $oRecipients->setWhere("RecipientGroupMemberCollection.idnewsgroup", $_REQUEST["restrictgroup"]);
}
// Search for
if ($_REQUEST["filter"] != "") {
    if ($_REQUEST["searchin"] == "--all--" || $_REQUEST["searchin"] == "") {
        foreach ($aFields as $sKey => $aData) {
            if (strpos($aData["type"], "search") !== false) {
                $oRecipients->setWhereGroup("filter", "recipientcollection." . $aData["field"], $_REQUEST["filter"], "LIKE");
            }
        }
        $oRecipients->setInnerGroupCondition("filter", "OR");
    } else {
        $oRecipients->setWhere("recipientcollection." . $_REQUEST["searchin"], $_REQUEST["filter"], "LIKE");
    }
}
// Items / page
if ($_REQUEST["elemperpage"] > 0) {
    // Getting item count without limit (for page function) - better idea anyone (performance)?
    $oRecipients->query();
    $iItemCount = $oRecipients->count();
    if ($_REQUEST["elemperpage"] * $_REQUEST["page"] >= $iItemCount + $_REQUEST["elemperpage"] && $_REQUEST["page"] != 1) {
        $_REQUEST["page"]--;
    }
    $oRecipients->setLimit($_REQUEST["elemperpage"] * ($_REQUEST["page"] - 1), $_REQUEST["elemperpage"]);
} else {
    $iItemCount = 0;