Function validateObject