diff --git a/ui/app/controllers/CControllerMediatypeList.php b/ui/app/controllers/CControllerMediatypeList.php
index 408ccc81be5..c50cdee7dea 100644
--- a/ui/app/controllers/CControllerMediatypeList.php
+++ b/ui/app/controllers/CControllerMediatypeList.php
@@ -105,12 +105,14 @@ class CControllerMediatypeList extends CController {
 				EVENT_SOURCE_INTERNAL => $this->checkAccess(CRoleHelper::UI_CONFIGURATION_INTERNAL_ACTIONS),
 				EVENT_SOURCE_SERVICE => $this->checkAccess(CRoleHelper::UI_CONFIGURATION_SERVICE_ACTIONS)
 			];
-			$actionids = array_merge(...array_map(static fn($media_type): array => $media_type['actions']
-				? array_column($media_type['actions'], 'actionid')
-				: [], $data['mediatypes']
-			));
-			$actions = [];
-			$operations = ['operations', 'recovery_operations', 'update_operations'];
+
+			$actionids = [];
+
+			foreach ($data['mediatypes'] as $media_type) {
+				if ($media_type['actions']) {
+					$actionids = array_merge($actionids, array_column($media_type['actions'], 'actionid'));
+				}
+			}
 
 			if ($actionids) {
 				$actions = API::Action()->get([
@@ -123,9 +125,28 @@ class CControllerMediatypeList extends CController {
 				]);
 			}
 
-			$data['mediatypes'] = self::processMediaTypes($data['mediatypes'], $actions, $operations, $filter,
-				$access_to_actions
-			);
+			foreach ($data['mediatypes'] as &$media_type) {
+				$media_type['typeid'] = $media_type['type'];
+				$media_type['type'] = CMediatypeHelper::getMediaTypes($media_type['type']);
+
+				if ($media_type['actions']) {
+					$media_type['actions'] = $this->processActions($media_type['actions'], $actions,
+						$media_type['mediatypeid']
+					);
+					$media_type['actions'] = $this->filterActions($media_type['actions'], $filter['actions']);
+				}
+
+				$media_type['action_count_total'] = count($media_type['actions']);
+				$media_type['actions'] = array_slice($media_type['actions'], 0,
+					CSettingsHelper::get(CSettingsHelper::MAX_IN_TABLE)
+				);
+
+				foreach ($media_type['actions'] as &$action) {
+					$action['is_editable'] = $access_to_actions[$action['eventsource']];
+				}
+				unset($action);
+			}
+
 			CArrayHelper::sort($data['mediatypes'], [['field' => $sort_field, 'order' => $sort_order]]);
 		}
 
@@ -141,89 +162,64 @@ class CControllerMediatypeList extends CController {
 		$this->setResponse($response);
 	}
 
-	private static function processActions(array $media_type, array $actions, array $operations): array {
-		foreach ($media_type['actions'] as $media_type_actionid => &$media_type_action) {
+	private function processActions($mediatype_actions, $actions, $mediatype_id): array {
+		$mediatype_actions = array_column($mediatype_actions, null, 'actionid');
+
+		foreach ($mediatype_actions as $mt_actionid => &$mt_action) {
 			foreach ($actions as $actionid => $action) {
-				if (bccomp($media_type_actionid, $actionid) == 0) {
-					$media_type_action = array_reduce($operations, static fn($carry, $operation): array =>
-						self::processActionOperation($media_type, $carry, $action, $operation),
-						$media_type_action
-					);
+				if (bccomp($mt_actionid, $actionid) == 0) {
+					$mt_action = $this->processOperations($mt_action, $action, $mediatype_id);
 				}
 			}
 		}
-		unset($media_type_action);
+		unset($mt_action);
 
-		return $media_type['actions'];
+		return $mediatype_actions;
 	}
 
-	private static function processActionOperation($media_type, $media_type_action, $action, $action_operation) {
-		foreach ($action[$action_operation] as $operation) {
-			if (in_array($operation['operationtype'], [OPERATION_TYPE_MESSAGE, OPERATION_TYPE_UPDATE_MESSAGE])) {
-				$media_type_action['has_message'] = true;
-
-				if (bccomp($operation['opmessage']['mediatypeid'], $media_type['mediatypeid']) == 0) {
-					$media_type_action['specific'] = true;
-				}
-				elseif (bccomp($operation['opmessage']['mediatypeid'], 0) == 0) {
-					$media_type_action['all_available'] = true;
+	private function processOperations($mt_action, $action, $mediatype_id) {
+		foreach (['operations', 'recovery_operations', 'update_operations'] as $operations) {
+			foreach ($action[$operations] as $operation) {
+				if ($operation['operationtype'] == OPERATION_TYPE_MESSAGE
+						|| $operation['operationtype'] == OPERATION_TYPE_UPDATE_MESSAGE) {
+					$mt_action['has_message'] = true;
+
+					if (bccomp($operation['opmessage']['mediatypeid'], $mediatype_id) == 0) {
+						$mt_action['specific'] = true;
+					}
+					elseif (bccomp($operation['opmessage']['mediatypeid'], 0) == 0) {
+						$mt_action['all_available'] = true;
+					}
 				}
 			}
 		}
 
-		return $media_type_action;
+		return $mt_action;
 	}
 
-	private static function filterActions(array $actions, array $filter): array {
+	private function filterActions($actions, $filter_actions) {
 		foreach ($actions as $actionid => $action) {
 			$has_message = array_key_exists('has_message', $action);
 			$specific = array_key_exists('specific', $action);
 			$all_available = array_key_exists('all_available', $action);
 
 			if (!$has_message) {
-				unset($actions[$actionid]);
+				unset($action[$actionid]);
 
 				continue;
 			}
 
-			if ($filter['actions'] == ZBX_MEDIA_TYPE_ACTIONS_SPECIFIC && !$specific) {
-				unset($actions[$actionid]);
+			if ($filter_actions == ZBX_MEDIA_TYPE_ACTIONS_SPECIFIC && !$specific) {
+				unset($action[$actionid]);
 			}
-			elseif ($filter['actions'] == ZBX_MEDIA_TYPE_ACTIONS_AVAILABLE && !$all_available) {
-				unset($actions[$actionid]);
+			elseif ($filter_actions == ZBX_MEDIA_TYPE_ACTIONS_AVAILABLE && !$all_available) {
+				unset($action[$actionid]);
 			}
-			elseif ($filter['actions'] == ZBX_MEDIA_TYPE_ACTIONS_ALL && !$specific && !$all_available) {
-				unset($actions[$actionid]);
+			elseif ($filter_actions == ZBX_MEDIA_TYPE_ACTIONS_ALL && !$specific && !$all_available) {
+				unset($action[$actionid]);
 			}
 		}
 
 		return $actions;
 	}
-
-	private static function processMediaTypes(array $media_types, array $actions, array $operations, array $filter,
-			array $access_to_actions): array {
-		foreach ($media_types as &$media_type) {
-			$media_type['typeid'] = $media_type['type'];
-			$media_type['type'] = CMediatypeHelper::getMediaTypes($media_type['type']);
-
-			if ($media_type['actions']) {
-				$media_type['actions'] = array_column($media_type['actions'], null, 'actionid');
-				$media_type['actions'] = self::processActions($media_type, $actions, $operations);
-				$media_type['actions'] = self::filterActions($media_type['actions'], $filter);
-			}
-
-			$media_type['action_count_total'] = count($media_type['actions']);
-			$media_type['actions'] = array_slice($media_type['actions'], 0,
-				CSettingsHelper::get(CSettingsHelper::MAX_IN_TABLE)
-			);
-
-			foreach ($media_type['actions'] as &$action) {
-				$action['is_editable'] = $access_to_actions[$action['eventsource']];
-			}
-			unset($action);
-		}
-		unset($media_type);
-
-		return $media_types;
-	}
 }
