protected function convertAclToQueryArray(AclInterface $acl, $principalControl, $permissionControl)
    {
        $acesArray = [];
        $principalCounter = 0;

        foreach ($acl->getAces() as $ace) {
            $permissions = $ace->getPermissions();
            if ($ace->getPrincipal() !== null && $ace->getPrincipal()->getId() && !empty($permissions)) {
                $acesArray[$principalControl][$principalCounter] = $ace->getPrincipal()->getId();
                $permissionCounter = 0;
                $acesArray[$permissionControl][$principalCounter] = [];

                foreach ($permissions as $permission) {
                    $acesArray[$permissionControl][$principalCounter][$permissionCounter] = $permission;
                    $permissionCounter ++;
                }

                $principalCounter ++;
            }
        }

        return $acesArray;
    }