/**
* Populates the given resource with the values in the form; overwriting any existing items.
*
* @param \Hal\Resource $resource
* @param FormInterface $form
*
* @return void
*/
public function populateResourceWithForm(Resource $resource, FormInterface $form)
{
$formData = $form->getData();
$resource->setData(array('username' => $formData['username'], 'email' => $formData['email']));
}