$privilegesToSet ]; } public function getPermissionsToAdd(array $currentPrivileges, array $addRemove): array { if (empty($addRemove['add'])) { return []; } // we are adding everything except we already have return $this->arrayDiffRecursive($addRemove['add'], $currentPrivileges); } public function getPermissionsToRemove(array $currentPrivileges, array $addRemove): array { if (empty($addRemove['add'])) { return []; } // we are removing everything we do not need return $this->arrayDiffRecursive($currentPrivileges, $addRemove['add']); } }