public static function setPermissionsOnEntryForGroup($author_id, $entry_id, $group_id, $group_access_options)
 {
     $ega = new EntryGroupAccess();
     $ega->setSafe('author_id', $author_id);
     $ega->setSafe('entry_id', $entry_id);
     $ega->setSafe('group_id', $group_id);
     $unused_perms = array('can_view' => 0, 'can_edit' => 1, 'can_delete' => 2, 'can_manage_access' => 3);
     if ($group_access_options) {
         foreach ($group_access_options as $opt) {
             $ega->set(Query::clean($opt), 1);
             unset($unused_perms[$opt]);
         }
     }
     $unused_perms = array_flip($unused_perms);
     foreach ($unused_perms as $opt) {
         $ega->set(Query::clean($opt), 0);
     }
     $ega->replace();
     $ega->save();
 }