Added document model validation
Fixed unittest