Use $resource to make controllers prettier.