Added model validation to API