Refactoring ot save new pictures in database