refactoring and adding spec tests to deposit entity