Spam Detection and Recovery Model for WSN