Checking for a valid object when saving or updating.