added functionality to save new units in the database