public boolean addSubscription(String from, String to){
Query q_from = new Query(ACCOUNT_KIND);
q_from.addFilter(ACCOUNT_ID_PROPERTY, FilterOperator.EQUAL, from);
q_from.setKeysOnly();
PreparedQuery pq_from = datastore.prepare(q_from);
Entity e_from = pq_from.asSingleEntity();
Query q_to = new Query(ACCOUNT_KIND);
q_to.addFilter(ACCOUNT_ID_PROPERTY, FilterOperator.EQUAL, to);
q_to.setKeysOnly();
PreparedQuery pq_to = datastore.prepare(q_to);
Entity e_to = pq_to.asSingleEntity();
if(e_from == null || e_to == null)
return false;
Key k_from = e_from.getKey();
Key k_to = e_to.getKey();
if(checkSubscriptionExists(k_from, from, k_to, to))
return false;
Transaction txn = datastore.beginTransaction();
Entity sub_from = new Entity(SUBSCRIPTION_KIND, k_from);
sub_from.setProperty(SUBSCRIPTION_EMAIL_PROPERTY, to);
//When first add, set a pending request
sub_from.setProperty(SUBSCRIPTION_STATUS_PROPERTY, "Waiting");
datastore.put(sub_from);
Entity sub_to = new Entity(SUBSCRIPTION_KIND, k_to);
sub_to.setProperty(SUBSCRIPTION_EMAIL_PROPERTY, from);
sub_to.setProperty(SUBSCRIPTION_STATUS_PROPERTY, "Pending");
datastore.put(sub_to);
txn.commit();
return true;
}