Working save functionality with transaction