Perhaps a helper method would be useful here, or you could use a virtual attribute.