moving logic for ajax calls to collections and mdoels