questo articolo dovrebbe risolvere i tuoi dubbi https://coderwall.com/p/ygcyha