made controller functions for create and update