Fixed functions to save and delete elements from a collection