Remove duplicated code and allowed models to optionally define the hash of data to send to the CloudSearch.

I did not perform many pull requests so I am unsure if I do the right thing.

I noticed some duplicated code which I refactored into a single method.
This has also the benefit of allowing each model to optionally define how the hash of data should be constructed to adapt to special cases.

Let me know if you have any questions or if you need me to make any corrections like the name of the method or the comments.