there will be only one iteration and first taken categoryId will be returned