Moving some function to common file

Change-Id: I8ada4e9296b2b61f13642e2da8b113453bfb5423