/**
  * 
  * @return \models\API2ApplicationModel
  */
 public function create(UserAccountModel $user, $title)
 {
     global $DB;
     $app = new API2ApplicationModel();
     $app->setTitle($title);
     $app->setAppSecret(createKey(1, 255));
     $app->setAppToken(createKey(1, 255));
     $stat = $DB->prepare("INSERT INTO  api2_application_information (user_id,title,app_token,app_secret,created_at) " . "VALUES (:user_id,:title,:app_token,:app_secret,:created_at) RETURNING id");
     $stat->execute(array('user_id' => $user->getId(), 'title' => $title, 'app_token' => $app->getAppToken(), 'app_secret' => $app->getAppSecret(), 'created_at' => \TimeSource::getFormattedForDataBase()));
     $data = $stat->fetch();
     $app->setId($data['id']);
     return $app;
 }