public function getAllCharacterNewestMail(int $limit = 10): Collection
    {

        $user = auth()->user();

        $messages = MailHeader::select('mail_id', 'from', 'character_id', 'subject');

        // If the user is a super user, return all
        if (! $user->hasSuperUser()) {

            $messages = $messages->where(function ($query) use ($user) {

                $characters = [];

                // get all user characters affiliation, including those whose are owned by himself
                foreach ($user->getAffiliationMap()['char'] as $characterID => $permissions) {

                    // check for both character wildcard and character mail permission in order to grant the access
                    if (in_array('character.*', $permissions, true) ||
                        in_array('character.mail', $permissions, true)
                    )
                        $characters[] = $characterID;
                }

                // Add the collected characterID on previous task to mail records filter
                $query->whereIn('character_id', $characters)
                    ->orWhereIn('from', $characters);
            });

        }

        return $messages->orderBy('timestamp', 'desc')
            ->limit($limit)
            ->get();
    }