Refactoring to save new picture in database