Back-end functionality,created photos model,added validations,flash messages