public function getMask(array $permissions)
    {
        $maskBuilder = new MaskBuilder();

        foreach ($permissions as $permission) {
            try {
                $maskBuilder->add($permission);
            } catch (InvalidArgumentException $e) {
                throw new InvalidPermissionException('Invalid permission mask: '.$permission, $permission, $e);
            }
        }

        return $maskBuilder->get();
    }