Moved user creation function to API