Another batch of improved logging
Move update_entity_count(resource) to models.py