Moved id generation from model to repositories