Using trust and local reputation for group formation in the Cloud of Things