add generic method to convert dto <--> entity; bug fix