image to db writing code moving to main solution