Moved facebook api logic to api.py