refacotring to more active record commands is needed