* Optimize AddToEntityList for end of list edgecase
* Move the logic into a utility function, namespace Algorithm
* Use references over pointers when its known to be not null
* Strengthen the Algorithm.hpp
* Work around false positive warning in GCC 12/13
---------
Co-authored-by: ζeh Matt <5415177+ZehMatt@users.noreply.github.com>