public function paginate(Query $query, $page = 1, $limit = 10, $fetchJoinCollection = false): array
    {
        $paginator = new Paginator($query, $fetchJoinCollection);
        $totalItems = $paginator->count();
        $pagesCount = ceil($totalItems / $limit);
        $paginator
            ->getQuery()
            ->setFirstResult($limit * ($page - 1))// offset
            ->setMaxResults($limit); // limit

        return [
            'meta' => [
                'page' => $page,
                'total' => $totalItems,
                'pages' => $pagesCount,
                'limit' => $limit,
            ],
            'data' => $paginator
        ];
    }