Move helper methods onto the model