Avoid repeated code into views and controllers