https://devhubby.com/thread/how-to-dynamically-add-a-constraint-to-a-model-from