public static function createMessages($dbMessages)
    {
        if (!is_array($dbMessages)) {
            $dbMessages = [$dbMessages];
        }
        $result = [];
        foreach ($dbMessages as $dbMessage) {
            $attributes = $dbMessage->getAttributes();
            $attributes['subscriber_id'] = $dbMessage->subscription_id === null ? null : $dbMessage->subscription->subscriber_id;
            unset($attributes['queue_id']);
            unset($attributes['subscription_id']);
            unset($attributes['mimetype']);
            $message = new components\Message();
            $message->setAttributes($attributes);
            $result[] = $message;
        }

        return $result;
    }