This commit makes sure to clean up resources when a previously expiring entity is persisted by setting the time to live to zero or negative. In case a phantom copy exists for the changed entity, it is removed to free space on the server and prevent expiration events from being sent. Closes #1955 Original Pull Request: #1961