[SDESK-49] Fixes curve building issue where multiple exogenous curves exist

* Fix remove() element via iterator rather than directly from the collection
* Added test
Line lengths in this whole block are just too long to review properly on Github