Implemented the saving form logic