refactoring to save new pics in db
refactoring to save new pics in db