Re-factored working with doctrine entities