Implemented registre functionality together with the saving in the Database