title: How to store data obtained with retrofit into database
body: <p>I have an android app and I'm getting data from web api with retrofit. </p>
  
  <p>Now I need to save this data into my table. I'm using active android. </p>
  
  <p>My table model "Partners", the data which I'm retrieving from web api and needs to be saved into this table Partners.</p>
  
  <pre><code>@Table(name = "Partners")
  public class Partners extends Model {
      @Expose
      @Column(name = "Name")
      public String name;
      public Partners() {}
      public List&lt;Partners&gt; getPartners() { return getMany(Partners.class, "Partners");}
  } 
  </code></pre>
  
  <p>I have created ApiService    </p>
  
  <pre><code>public interface APIService {    
      @GET("Partners")
      Call&lt;Partners&gt; getPartners();
  }
  </code></pre>
  
  <p>I have api helper </p>
  
  <pre><code>public class APIHelper {
  
      public static APIService apiService;
  
      public static APIService getApiService() {
          if (apiService == null) {
              Retrofit retrofit = new Retrofit.Builder().baseUrl("https://here-is-part-of-link/partners.json")
                      .addConverterFactory(GsonConverterFactory.create()).build();
              apiService = retrofit.create(APIService.class);
          }
          return apiService;
      }
  }
  </code></pre>
  
  <p>An this is my fragment where I'm trying to invoke method to get data from web api. </p>
  
  <pre><code>public class MainFragment extends Fragment implements Callback&lt;Partners&gt; {
  
      Button shippingFragment, deliveryFragment, measurementFragment, takeOversFragment;
      private Call&lt;Partners&gt; call;
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
          View view = inflater.inflate(R.layout.main_fragment, parent, false);
          getActivity().setTitle("Title");
          shippingFragment = (Button) view.findViewById(R.id.shipping);
          deliveryFragment = (Button) view.findViewById(R.id.delivery);
          measurementFragment = (Button) view.findViewById(R.id.measurement);
          takeOversFragment = (Button) view.findViewById(R.id.take_overs);
          shippingFragment.setOnClickListener(btnFragmentListener);
          deliveryFragment.setOnClickListener(btnFragmentListener);
          measurementFragment.setOnClickListener(btnFragmentListener);
          takeOversFragment.setOnClickListener(btnFragmentListener);
  
          call = APIHelper.getApiService().getPartners();
          call.enqueue(this);
  
          return view;
      }
  
      Button.OnClickListener btnFragmentListener = (new Button.OnClickListener() {
          @Override
          public void onClick(View v) {
              Fragment fragment = null;
              Intent intent = null;
              switch (v.getId()) {
                  case R.id.shipping:
                      fragment = new ShippingFragment();
                      replaceFragment(fragment);
                      break;
                  case R.id.delivery:
                      fragment = new DeliveryMain();
                      replaceFragment(fragment);
                      break;
                  case R.id.measurement:
                      intent = new Intent(getActivity(), MeasurementMain.class);
                      startActivity(intent);
                      break;
                  case R.id.take_overs:
                      intent = new Intent(getActivity(), AllLogs.class);
                      startActivity(intent);
                      break;
              }
          }
      });
  
      public void replaceFragment(android.support.v4.app.Fragment rFragment) {
          FragmentTransaction transaction = getFragmentManager().beginTransaction();
          transaction.replace(R.id.fragment_holder, rFragment);
          transaction.addToBackStack(null);
          transaction.commit();
      }
  
      @Override
      public void onResponse(Call&lt;Partners&gt; call, Response&lt;Partners&gt; response) {
  
      }
  
      @Override
      public void onFailure(Call&lt;Partners&gt; call, Throwable t) {
          Log.e("Error!!!!!!!!", String.valueOf(call));
      }
  }
  </code></pre>
  
  <p>Now I need to save data into table "partners". I tried to do that in onResponse() method, but I failed. </p>
  
  <p><strong>QUESTION: Could somebody help me with saving data from web api into database?</strong> </p>
  
  <p>EDIT:
  <a href="https://i.stack.imgur.com/squty.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/squty.png" alt="enter image description here"></a></p>